Skip to content

Commit

Permalink
Merge pull request #2107 from mtrmac/recent-lint
Browse files Browse the repository at this point in the history
Fix build with golangci-lint 1.54.2
  • Loading branch information
rhatdan committed Sep 5, 2023
2 parents e8a1fd0 + 9676d8b commit c58e7f0
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import (
"github.com/containers/storage/pkg/reexec"
ddigest "github.com/opencontainers/go-digest"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slices"
)

var (
Expand Down Expand Up @@ -174,28 +174,16 @@ func TestParseWithGraphDriverOptions(t *testing.T) {
for _, optionList := range optionLists {
store := newStoreWithGraphDriverOptions(t, optionList)
ref, err := Transport.ParseStoreReference(store, "test")
if err != nil {
t.Fatalf("ParseStoreReference(%q, graph driver options %v) returned error %v", "test", optionList, err)
}
if ref == nil {
t.Fatalf("ParseStoreReference returned nil reference")
}
require.NoError(t, err, optionList)
require.NotNil(t, ref)
spec := ref.StringWithinTransport()
ref2, err := Transport.ParseReference(spec)
if err != nil {
t.Fatalf("ParseReference(%q) returned error %v", "test", err)
}
if ref == nil {
t.Fatalf("ParseReference returned nil reference")
}
require.NoError(t, err)
require.NotNil(t, ref)
sref, ok := ref2.(*storageReference)
if !ok {
t.Fatalf("ParseReference returned a reference from transport %s, not one of ours", ref2.Transport().Name())
}
require.True(t, ok, "transport %s", ref2.Transport().Name())
parsedOptions := sref.transport.store.GraphOptions()
if !slices.Equal(parsedOptions, optionList) {
t.Fatalf("Mismatched options: %#v and %#v", optionList, parsedOptions)
}
assert.Equal(t, optionList, parsedOptions)
}
}

Expand Down

0 comments on commit c58e7f0

Please sign in to comment.