Move lesson source into the teaching structure, align the course path with the learner's Go and DevOps experience, and add the interactive lesson guides. Add advanced DevOps lifecycle study as a separate section. Bound MQTT message work and drain accepted jobs during shutdown; align the backend implementation with the revised course through Section 6.
18 lines
447 B
Go
18 lines
447 B
Go
package config
|
|
|
|
import "testing"
|
|
|
|
func TestValidateRejectsDeviceIDThatCannotFormTopic(t *testing.T) {
|
|
cfg := Config{}
|
|
cfg.MQTT.URL = "mqtt://127.0.0.1:18883"
|
|
cfg.MQTT.ClientID = "lab-client"
|
|
cfg.MQTT.Username = "backend"
|
|
cfg.MQTT.Password = "lab-password"
|
|
cfg.MQTT.DeviceID = "device!001"
|
|
cfg.App.ConnectTimeout = "10s"
|
|
|
|
if err := cfg.Validate(); err == nil {
|
|
t.Fatal("Validate accepted a device ID rejected by the topic contract")
|
|
}
|
|
}
|