Skip to content

Remove expectation on token timeout #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions system_tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,20 +745,18 @@ func publishAndConsumeMQTTMsg(hostname, nodePort, username, password string, ove
c := mqtt.NewClient(opts)

var token mqtt.Token
for retry := 0; retry < 5; retry++ {
fmt.Printf("Attempt #%d to connect using MQTT\n", retry)
Eventually(func() bool {
token = c.Connect()
// Waits for the network request to reach the destination and receive a response
Expect(token.WaitTimeout(3 * time.Second)).To(BeTrue())
if !token.WaitTimeout(3 * time.Second) {
return false
}

if err := token.Error(); err == nil {
break
return true
}

time.Sleep(2 * time.Second)
}

Expect(token.Error()).ToNot(HaveOccurred())
return false
}, 10, 2).Should(BeTrue(), "Expected to be able to connect to MQTT port")

topic := "tests/mqtt"
msgReceived := false
Expand Down