Replace util.NormalizeImageRef with reference.ParseDockerRef

Using the utility caused other project to have containerd/cri
as a dependency, only for this utility. The new `reference.ParseDockerRef`
function does the same (it's a copy of this function).

Tests were kept for now, but could be removed in future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2019-02-07 13:22:58 +01:00
parent 0ad60d4d9e
commit 51affb8839
5 changed files with 10 additions and 29 deletions

View File

@@ -23,6 +23,7 @@ import (
"github.com/BurntSushi/toml"
"github.com/containerd/containerd/runtime/linux/runctypes"
runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
"github.com/docker/distribution/reference"
imagedigest "github.com/opencontainers/go-digest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -31,7 +32,6 @@ import (
criconfig "github.com/containerd/cri/pkg/config"
"github.com/containerd/cri/pkg/store"
imagestore "github.com/containerd/cri/pkg/store/image"
"github.com/containerd/cri/pkg/util"
)
// TestGetUserFromImage tests the logic of getting image uid or user name of image user.
@@ -104,7 +104,7 @@ func TestGetRepoDigestAndTag(t *testing.T) {
},
} {
t.Logf("TestCase %q", desc)
named, err := util.NormalizeImageRef(test.ref)
named, err := reference.ParseDockerRef(test.ref)
assert.NoError(t, err)
repoDigest, repoTag := getRepoDigestAndTag(named, digest, test.schema1)
assert.Equal(t, test.expectedRepoDigest, repoDigest)