integration-cli/TestBuildEmitsEvents: Verify event count

Make sure that the events are not sent twice

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-03-20 19:25:12 +01:00
parent 6a0f71cac9
commit 99356b6e17

View File

@@ -6209,7 +6209,9 @@ func (s *DockerCLIBuildSuite) TestBuildEmitsEvents(t *testing.T) {
name: "no tag",
args: []string{},
check: func(t *testing.T, stdout string) {
assert.Check(t, is.Contains(stdout, "image create"))
if assert.Check(t, is.Contains(stdout, "image create")) {
assert.Check(t, strings.Count(stdout, "image create") == 1)
}
assert.Check(t, !strings.Contains(stdout, "image tag"))
},
},
@@ -6217,8 +6219,12 @@ func (s *DockerCLIBuildSuite) TestBuildEmitsEvents(t *testing.T) {
name: "with tag",
args: []string{"-t", "testbuildemitsimagetagevent"},
check: func(t *testing.T, stdout string) {
assert.Check(t, is.Contains(stdout, "image create"))
assert.Check(t, is.Contains(stdout, "image tag"))
if assert.Check(t, is.Contains(stdout, "image create")) {
assert.Check(t, strings.Count(stdout, "image create") == 1)
}
if assert.Check(t, is.Contains(stdout, "image tag")) {
assert.Check(t, strings.Count(stdout, "image tag") == 1)
}
assert.Check(t, is.Contains(stdout, "testbuildemitsimagetagevent"))
},
},