Skip to content

Commit

Permalink
fix11
Browse files Browse the repository at this point in the history
  • Loading branch information
庄润梓 committed Jun 24, 2024
1 parent 5d4163d commit 1983aa6
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions tests/e2e/greptimedbcluster_baremetal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,28 @@ var _ = Describe("Basic test of greptimedb cluster in baremetal", func() {
err = cmd.Start()
Expect(err).NotTo(HaveOccurred(), "failed to create cluster in baremetal")

for {
if conn, err := net.DialTimeout("tcp", "localhost:4000", 2*time.Second); err == nil {
defer conn.Close()
break
go func() {
// 轮询检测端口是否连接成功
for {
if conn, err := net.DialTimeout("tcp", "localhost:4000", 2*time.Second); err == nil {
defer conn.Close()
break
}
}
}

err = getClusterinBaremetal()
Expect(err).NotTo(HaveOccurred(), "failed to get cluster in baremetal")
err = getClusterinBaremetal()
Expect(err).NotTo(HaveOccurred(), "failed to get cluster in baremetal")

err = cmd.Cancel()
Expect(err).NotTo(HaveOccurred(), "failed to kill create cluster process")
if cmd.Process != nil {
err = cmd.Process.Kill()
Expect(err).NotTo(HaveOccurred(), "failed to kill create cluster process")
} else {
Fail("process is not properly initialized")
}
}()

err = cmd.Wait()
Expect(err).NotTo(HaveOccurred(), "failed to wait for create cluster process")

err = deleteClusterinBaremetal()
Expect(err).NotTo(HaveOccurred(), "failed to delete cluster in baremetal")
Expand Down

0 comments on commit 1983aa6

Please sign in to comment.