Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: use the stable image ID in test #1397

Merged
merged 1 commit into from
May 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions test/api_image_inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,27 @@ func init() {
// SetUpTest does common setup in the beginning of each test.
func (suite *APIImageInspectSuite) SetUpTest(c *check.C) {
SkipIfFalse(c, environment.IsLinux)
PullImage(c, busyboxImage)
PullImage(c, fmt.Sprintf("%s:%s", environment.BusyboxRepo, "1.24"))
}

// TestImageInspectOk tests inspecting images is OK.
func (suite *APIImageInspectSuite) TestImageInspectOk(c *check.C) {
repoID := environment.BusyboxID
repoTag, repoDigest := busyboxImage, fmt.Sprintf("%s@%s", environment.BusyboxRepo, environment.BusyboxDigest)
var (
repo = environment.BusyboxRepo
tag = "1.24"

id = "sha256:ca3d7d608b8a8bbaaac2c350bd0f9588cce0509ada74108d5c4b2afb24c46125"
dig = "sha256:840f2b98a2540ff1d265782c42543dbec7218d3ab0e73b296d7dac846f146e27"
)

repoTag := fmt.Sprintf("%s:%s", repo, tag)
repoDigest := fmt.Sprintf("%s@%s", repo, dig)

for _, image := range []string{
repoID,
id,
repoTag,
repoDigest,
fmt.Sprintf("%s:whatever@%s", environment.BusyboxRepo, environment.BusyboxDigest),
fmt.Sprintf("%s:whatever@%s", repo, dig),
} {
resp, err := request.Get("/images/" + image + "/json")
c.Assert(err, check.IsNil)
Expand All @@ -45,7 +53,7 @@ func (suite *APIImageInspectSuite) TestImageInspectOk(c *check.C) {

// TODO: More specific check is needed
c.Assert(got.Config, check.NotNil)
c.Assert(got.ID, check.Equals, repoID)
c.Assert(got.ID, check.Equals, id)
c.Assert(got.CreatedAt, check.NotNil)
c.Assert(got.Size, check.NotNil)
c.Assert(reflect.DeepEqual(got.RepoTags, []string{repoTag}), check.Equals, true)
Expand Down
6 changes: 0 additions & 6 deletions test/environment/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,9 @@ var (
// BusyboxRepo the repository of busybox image
BusyboxRepo = "registry.hub.docker.com/library/busybox"

// BusyboxID the digest ID used for busybox image
BusyboxID = "sha256:8ac48589692a53a9b8c2d1ceaa6b402665aa7fe667ba51ccc03002300856d8c7"

// BusyboxTag the tag used for busybox image
BusyboxTag = "1.28"

// BusyboxDigest the digest used for busybox image
BusyboxDigest = "sha256:58ac43b2cc92c687a32c8be6278e50a063579655fe3090125dcb2af0ff9e1a64"

// HelloworldRepo the repository of hello-world image
HelloworldRepo = "registry.hub.docker.com/library/hello-world"

Expand Down