From 99356b6e17c98bd05d8d3695e440a43117ba55f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Thu, 20 Mar 2025 19:25:12 +0100 Subject: [PATCH] integration-cli/TestBuildEmitsEvents: Verify event count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure that the events are not sent twice Signed-off-by: Paweł Gronowski --- integration-cli/docker_cli_build_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 77bfbbec52..e1dfd46e06 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -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")) }, },