Skip to content

Add non-cli counterpart of TestBuildEmitsEvents#50157

Open
aciba90 wants to merge 1 commit intomoby:masterfrom
aciba90:49679-add-non-cli-counterpart-of-TestBuildEmitsEvents
Open

Add non-cli counterpart of TestBuildEmitsEvents#50157
aciba90 wants to merge 1 commit intomoby:masterfrom
aciba90:49679-add-non-cli-counterpart-of-TestBuildEmitsEvents

Conversation

@aciba90
Copy link

@aciba90 aciba90 commented Jun 8, 2025

Fixes #49679

- What I did

I added a test integration-cli/docker_api_build_test.go mimicking TestBuildEmitsEvents under integration-cli/docker_cli_build_test.go to cover that additional code path per #49679.

- How I did it

I addapted the existent test to this testing environment.

- How to verify it

TESTFLAGS='-test.run TestDockerAPISuite/TestBuildEmitsEvents' make test-integration

- Human readable description for the release notes

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

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!

This is still an integration-cli test though. The integration-cli package is deprecated in favor of the e2e tests on the CLI.

What we currently need is a non-CLI integration test like these in:
https://github.com/moby/moby/tree/master/integration/build

Comment on lines +597 to +601
res, body, err := request.Post(
ctx,
"/build"+tc.query,
request.RawContent(bCtx.AsTarReader(t)),
request.ContentType("application/x-tar"))
Copy link
Contributor

Choose a reason for hiding this comment

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

In the integration tests, you can just use the regular API client like:

apiclient := testEnv.APIClient()
resp, err := apiclient.ImageBuild(ctx,
source.AsTarReader(t),
build.ImageBuildOptions{
Remove: true,
ForceRemove: true,
})

Fixes moby#49679

Signed-off-by: Alberto Contreras <alberto.contreras@canonical.com>
@aciba90 aciba90 force-pushed the 49679-add-non-cli-counterpart-of-TestBuildEmitsEvents branch from 7446be8 to b20951a Compare June 9, 2025 15:25
@aciba90
Copy link
Author

aciba90 commented Jun 9, 2025

Apologies for the misunderstanding. I have retargeted the test.

As the test was partially implemented in

func TestBuildEmitsImageCreateEvent(t *testing.T) {
, I have added the with tag test case to that one.

LMK if more changes are required, or if two separated tests are preferred.

Thanks, @vvoland, for pointing me to the right direction.

@aciba90 aciba90 requested a review from vvoland June 9, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add non-cli counterpart of TestBuildEmitsEvents

2 participants