Skip to content

Commit 15ab49d

Browse files
authored
Merge pull request #1404 from fuweid/checkpick_issue_1397
bugfix: use the stable image ID in test
2 parents b9cd0fc + f92d066 commit 15ab49d

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

test/api_image_inspect_test.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,27 @@ func init() {
2121
// SetUpTest does common setup in the beginning of each test.
2222
func (suite *APIImageInspectSuite) SetUpTest(c *check.C) {
2323
SkipIfFalse(c, environment.IsLinux)
24-
PullImage(c, busyboxImage)
24+
PullImage(c, fmt.Sprintf("%s:%s", environment.BusyboxRepo, "1.24"))
2525
}
2626

2727
// TestImageInspectOk tests inspecting images is OK.
2828
func (suite *APIImageInspectSuite) TestImageInspectOk(c *check.C) {
29-
repoID := environment.BusyboxID
30-
repoTag, repoDigest := busyboxImage, fmt.Sprintf("%s@%s", environment.BusyboxRepo, environment.BusyboxDigest)
29+
var (
30+
repo = environment.BusyboxRepo
31+
tag = "1.24"
32+
33+
id = "sha256:ca3d7d608b8a8bbaaac2c350bd0f9588cce0509ada74108d5c4b2afb24c46125"
34+
dig = "sha256:840f2b98a2540ff1d265782c42543dbec7218d3ab0e73b296d7dac846f146e27"
35+
)
36+
37+
repoTag := fmt.Sprintf("%s:%s", repo, tag)
38+
repoDigest := fmt.Sprintf("%s@%s", repo, dig)
3139

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

4654
// TODO: More specific check is needed
4755
c.Assert(got.Config, check.NotNil)
48-
c.Assert(got.ID, check.Equals, repoID)
56+
c.Assert(got.ID, check.Equals, id)
4957
c.Assert(got.CreatedAt, check.NotNil)
5058
c.Assert(got.Size, check.NotNil)
5159
c.Assert(reflect.DeepEqual(got.RepoTags, []string{repoTag}), check.Equals, true)

test/environment/env.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,9 @@ var (
2626
// BusyboxRepo the repository of busybox image
2727
BusyboxRepo = "registry.hub.docker.com/library/busybox"
2828

29-
// BusyboxID the digest ID used for busybox image
30-
BusyboxID = "sha256:8ac48589692a53a9b8c2d1ceaa6b402665aa7fe667ba51ccc03002300856d8c7"
31-
3229
// BusyboxTag the tag used for busybox image
3330
BusyboxTag = "1.28"
3431

35-
// BusyboxDigest the digest used for busybox image
36-
BusyboxDigest = "sha256:58ac43b2cc92c687a32c8be6278e50a063579655fe3090125dcb2af0ff9e1a64"
37-
3832
// HelloworldRepo the repository of hello-world image
3933
HelloworldRepo = "registry.hub.docker.com/library/hello-world"
4034

0 commit comments

Comments
 (0)