containerd/remotes/docker/scope_test.go
Daniel Nephin 3279acca82 Check timestamps in snapshot storage test suite
also use t.Helper()
convert assertions to canonical

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2018-02-12 12:26:26 -05:00

41 lines
800 B
Go

package docker
import (
"testing"
"github.com/containerd/containerd/reference"
"github.com/gotestyourself/gotestyourself/assert"
)
func TestRepositoryScope(t *testing.T) {
testCases := []struct {
refspec reference.Spec
push bool
expected string
}{
{
refspec: reference.Spec{
Locator: "host/foo/bar",
Object: "ignored",
},
push: false,
expected: "repository:foo/bar:pull",
},
{
refspec: reference.Spec{
Locator: "host:4242/foo/bar",
Object: "ignored",
},
push: true,
expected: "repository:foo/bar:pull,push",
},
}
for _, x := range testCases {
t.Run(x.refspec.String(), func(t *testing.T) {
actual, err := repositoryScope(x.refspec, x.push)
assert.NilError(t, err)
assert.Equal(t, x.expected, actual)
})
}
}