Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
lint and nits
Browse files Browse the repository at this point in the history
Signed-off-by: Yee Hing Tong <[email protected]>
  • Loading branch information
wild-endeavor committed Jul 10, 2023
1 parent c392b71 commit 784a1a6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion cli/pflags/api/namedtype_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions storage/cached_rawstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestNewCachedStore(t *testing.T) {
t.Run("CachingDisabled", func(t *testing.T) {
cfg := &Config{}
assert.Nil(t, newCachedRawStore(cfg, nil, metrics.cacheMetrics))
store, err := NewInMemoryRawStore(cfg, metrics)
store, err := NewInMemoryRawStore(context.TODO(), cfg, metrics)
assert.NoError(t, err)
assert.Equal(t, store, newCachedRawStore(cfg, store, metrics.cacheMetrics))
})
Expand All @@ -31,7 +31,7 @@ func TestNewCachedStore(t *testing.T) {
TargetGCPercent: 20,
},
}
store, err := NewInMemoryRawStore(cfg, metrics)
store, err := NewInMemoryRawStore(context.TODO(), cfg, metrics)
assert.NoError(t, err)
cStore := newCachedRawStore(cfg, store, metrics.cacheMetrics)
assert.Equal(t, 20, debug.SetGCPercent(100))
Expand Down
1 change: 1 addition & 0 deletions storage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package storage

import (
"context"

"github.com/flyteorg/flytestdlib/config"
"github.com/flyteorg/flytestdlib/logger"
)
Expand Down
4 changes: 2 additions & 2 deletions storage/mem_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package storage
import (
"bytes"
"context"
"crypto/md5"
"crypto/md5" // #nosec
"encoding/hex"
"fmt"
"io"
Expand Down Expand Up @@ -40,7 +40,7 @@ func (s *InMemoryStore) Head(ctx context.Context, reference DataReference) (Meta
data, found := s.cache[reference]
var hash [md5.Size]byte
if found {
hash = md5.Sum(data)
hash = md5.Sum(data) // #nosec
}

return MemoryMetadata{
Expand Down
12 changes: 6 additions & 6 deletions storage/mem_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (

func TestInMemoryStore_Head(t *testing.T) {
t.Run("Empty store", func(t *testing.T) {
s, err := NewInMemoryRawStore(&Config{}, metrics)
s, err := NewInMemoryRawStore(context.TODO(), &Config{}, metrics)
assert.NoError(t, err)
metadata, err := s.Head(context.TODO(), DataReference("hello"))
assert.NoError(t, err)
assert.False(t, metadata.Exists())
})

t.Run("Existing Item", func(t *testing.T) {
s, err := NewInMemoryRawStore(&Config{}, metrics)
s, err := NewInMemoryRawStore(context.TODO(), &Config{}, metrics)
assert.NoError(t, err)
err = s.WriteRaw(context.TODO(), DataReference("hello"), 0, Options{}, bytes.NewReader([]byte{}))
assert.NoError(t, err)
Expand All @@ -31,7 +31,7 @@ func TestInMemoryStore_Head(t *testing.T) {

func TestInMemoryStore_ReadRaw(t *testing.T) {
t.Run("Empty store", func(t *testing.T) {
s, err := NewInMemoryRawStore(&Config{}, metrics)
s, err := NewInMemoryRawStore(context.TODO(), &Config{}, metrics)
assert.NoError(t, err)

raw, err := s.ReadRaw(context.TODO(), DataReference("hello"))
Expand All @@ -40,7 +40,7 @@ func TestInMemoryStore_ReadRaw(t *testing.T) {
})

t.Run("Existing Item", func(t *testing.T) {
s, err := NewInMemoryRawStore(&Config{}, metrics)
s, err := NewInMemoryRawStore(context.TODO(), &Config{}, metrics)
assert.NoError(t, err)

err = s.WriteRaw(context.TODO(), DataReference("hello"), 0, Options{}, bytes.NewReader([]byte{}))
Expand All @@ -52,7 +52,7 @@ func TestInMemoryStore_ReadRaw(t *testing.T) {
}

func TestInMemoryStore_Clear(t *testing.T) {
m, err := NewInMemoryRawStore(&Config{}, metrics)
m, err := NewInMemoryRawStore(context.TODO(), &Config{}, metrics)
assert.NoError(t, err)

mStore := m.(*InMemoryStore)
Expand All @@ -71,7 +71,7 @@ func TestInMemoryStore_Clear(t *testing.T) {
}

func TestInMemoryStore_Delete(t *testing.T) {
m, err := NewInMemoryRawStore(&Config{}, metrics)
m, err := NewInMemoryRawStore(context.TODO(), &Config{}, metrics)
assert.NoError(t, err)

mStore := m.(*InMemoryStore)
Expand Down
3 changes: 2 additions & 1 deletion storage/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package storage

import (
"context"
"os"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"os"

stdErrs "github.com/flyteorg/flytestdlib/errors"
"github.com/flyteorg/flytestdlib/promutils/labeled"
Expand Down

0 comments on commit 784a1a6

Please sign in to comment.