From 9a3dce99655e9d5e216b5468dee15397f2731043 Mon Sep 17 00:00:00 2001 From: ashing Date: Sun, 27 Aug 2023 23:09:01 +0800 Subject: [PATCH] fix: defer Signed-off-by: ashing --- test/e2e/broadcast/broadcast.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/broadcast/broadcast.go b/test/e2e/broadcast/broadcast.go index 638a6c2..76b56d1 100644 --- a/test/e2e/broadcast/broadcast.go +++ b/test/e2e/broadcast/broadcast.go @@ -46,8 +46,8 @@ var _ = ginkgo.Describe("CLI", func() { gomega.Expect(err).Should(gomega.BeNil()) pid := cmd.Process.Pid gomega.Expect(pid).Should(gomega.BeNumerically(">", 0)) - go func() { - time.Sleep(3 * time.Second) + defer func() { + var err error err = cmd.Process.Signal(syscall.SIGINT) gomega.Expect(err).Should(gomega.BeNil()) err = cmd.Wait() @@ -61,7 +61,7 @@ var _ = ginkgo.Describe("CLI", func() { err = notifyCmd.Run() gomega.Expect(err).Should(gomega.BeNil()) // check log - time.Sleep(5 * time.Second) + time.Sleep(2 * time.Second) gomega.Expect(out.String()).Should(gomega.ContainSubstring("add agent agent_1 region_123456")) gomega.Expect(out.String()).Should(gomega.ContainSubstring("add agent agent_2 region_123456")) gomega.Expect(out.String()).Should(gomega.ContainSubstring("key: /config/region_123456 value: value change"))