Skip to content

migrate test api images history integration cli test to integration test#50390

Merged
vvoland merged 3 commits intomoby:masterfrom
Abubacarr075:50159-migrate-api-images-history-cli-tests-to-integration
Jul 14, 2025
Merged

migrate test api images history integration cli test to integration test#50390
vvoland merged 3 commits intomoby:masterfrom
Abubacarr075:50159-migrate-api-images-history-cli-tests-to-integration

Conversation

@Abubacarr075
Copy link
Contributor

@Abubacarr075 Abubacarr075 commented Jul 11, 2025

- What I did

Migrated the TestAPIImagesHistory to integration tests in reference to the integration-cli migration epic #50159

- How I did it

I leveraged the integration/internal/build package to build an image and tested the imageHistory on it

- How to verify it
Run the integration test as follows

TEST_INTEGRATION_DIR=./integration/image TESTFLAGS='-test.run TestAPIImagesHistory' ./hack/make.sh dynbinary test-integration

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
@vvoland vvoland added area/testing kind/refactor PR's that refactor, or clean-up code labels Jul 11, 2025
@vvoland vvoland added this to the 29.0.0 milestone Jul 11, 2025
Copy link
Contributor

@vvoland vvoland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Left some small comments, but looks good overall ❤️

"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/client"
buildImage "github.com/docker/docker/integration/internal/build"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just use the build package as it doesn't seem to clash with other imports.

Suggested change
buildImage "github.com/docker/docker/integration/internal/build"
"github.com/docker/docker/integration/internal/build"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted.
Initially, there was a clash as I hadn't updated my branch for a while prior to making a commit. I will update it.

imgID := buildImage.Do(ctx, t, client, fakecontext.New(t, t.TempDir(), fakecontext.WithDockerfile(dockerfile)))

historydata, err := client.ImageHistory(ctx, imgID)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


func TestAPIImagesHistory(t *testing.T) {
ctx := setupTest(t)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can remove the extra spacing

Suggested change

Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
Signed-off-by: Abubacarr Ceesay <abubacarr671@gmail.com>
Copy link
Contributor

@vvoland vvoland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@vvoland vvoland merged commit a470ad7 into moby:master Jul 14, 2025
161 of 163 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing kind/refactor PR's that refactor, or clean-up code process/cherry-picked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants