Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Add other client ID and another sleep to fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
muellermartin committed Mar 16, 2022
1 parent 321accb commit 53874f1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestMqtt(t *testing.T) {

m := mqtt.NewClient(&mqtt.ClientOptions{
Servers: []*url.URL{s.MqttURL},
ClientID: s.MqttClientId,
ClientID: "go-mqtt-spacestatus-test",
AutoReconnect: true,
OnConnect: func(c mqtt.Client) { log.Info("connected") },
OnConnectionLost: func(c mqtt.Client, err error) { log.Errorf("connection lost: %v", err) },
Expand All @@ -47,6 +47,8 @@ func TestMqtt(t *testing.T) {
_ = m.Publish("sensor/radiation/cpm", 0, false, "42")
_ = m.Publish("sensor/radiation/uSv", 0, false, "0.23")

<-time.After(1 * time.Second)

resp, err := http.Get("http://localhost:8080/")
if err != nil {
t.Errorf("Unable to query API: %v", err)
Expand Down

0 comments on commit 53874f1

Please sign in to comment.