-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8ebc8f
commit c6b6c5b
Showing
10 changed files
with
240 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package mqtt_client_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestMqttClient(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "MqttClient Suite") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package mqtt_client | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
"github.com/rabbitmq/omq/pkg/config" | ||
) | ||
|
||
var _ = Context("MQTT 3.1/3.1.1 client", func() { | ||
Describe("uses the correct URI for the publisher", func() { | ||
cfg := config.Config{ | ||
PublisherUri: []string{"mqtt://publisher:1883"}, | ||
PublisherId: "my-client-id-%d", | ||
MqttPublisher: config.MqttOptions{ | ||
Version: 3, | ||
CleanSession: true, | ||
}, | ||
} | ||
publisher := NewMqttPublisher(cfg, 1) | ||
opts := publisher.connectionOptions() | ||
Expect(opts.ClientID).To(Equal("my-client-id-1")) | ||
Expect(opts.Servers[0].Host).To(Equal("publisher:1883")) | ||
}) | ||
Describe("MQTT 5.0 client", func() { | ||
Describe("uses the correct URI for the publisher", func() { | ||
It("--publisher-uri", func() { | ||
cfg := config.Config{ | ||
PublisherUri: []string{"mqtt://publisher:1883"}, | ||
PublisherId: "my-client-id-%d", | ||
MqttPublisher: config.MqttOptions{ | ||
Version: 5, | ||
CleanSession: true, | ||
}, | ||
} | ||
publisher := NewMqtt5Publisher(cfg, 1) | ||
opts := publisher.connectionOptions() | ||
Expect(opts.ClientID).To(Equal("my-client-id-1")) | ||
Expect(opts.ServerUrls[0].Host).To(Equal("publisher:1883")) | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.