Skip to content

Commit 8c0cc1b

Browse files
committed
fix and enable tests in pipeline
1 parent b694ed3 commit 8c0cc1b

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

.github/workflows/go.yml

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
3434
dep ensure
3535
fi
36+
- name: Run Unit-Tests
37+
run: go test -v ./...
3638
- name: Build
3739
env:
3840
CGO_ENABLED: 0

internal/mqtt/config/topic_test.go

+10-15
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ func TestLoadTopicConfiguration(t *testing.T) {
4343
Available: "ON",
4444
Unavailable: "OFF",
4545
},
46-
Interval: interval(13 * time.Second),
4746
},
4847
},
4948
},
@@ -60,7 +59,6 @@ func TestLoadTopicConfiguration(t *testing.T) {
6059
Available: "Online",
6160
Unavailable: "Offline",
6261
},
63-
Interval: interval(30 * time.Second),
6462
},
6563
},
6664
},
@@ -74,11 +72,6 @@ func TestLoadTopicConfiguration(t *testing.T) {
7472
content: `{ "availability": { "topic": "" } }`,
7573
expectedError: "invalid config: invalid availability topic: must not be empty",
7674
},
77-
{
78-
name: "Availability invalid interval",
79-
content: `{ "availability": { "topic": "test", "interval": "t" } }`,
80-
expectedError: "could not read topic configuration file: invalid interval: time: invalid duration t",
81-
},
8275
{
8376
name: "Sensor",
8477
content: `{
@@ -95,15 +88,17 @@ func TestLoadTopicConfiguration(t *testing.T) {
9588
}]
9689
}`, expectedResult: TopicConfigurations{
9790
Sensor: []Sensor{{
98-
Name: "My sweat sensor",
99-
ResultTopic: fmt.Sprintf("tele/%s/status", deviceId),
100-
Interval: *interval(13 * time.Second),
101-
Unit: "kWh",
102-
Icon: "hassio-icon",
103-
Command: Command{
104-
Name: "/usr/bin/bash",
105-
Arguments: []string{"echo"},
91+
GeneralSensor: GeneralSensor{
92+
ResultTopic: fmt.Sprintf("tele/%s/status", deviceId),
93+
Interval: *interval(13 * time.Second),
94+
Command: Command{
95+
Name: "/usr/bin/bash",
96+
Arguments: []string{"echo"},
97+
},
10698
},
99+
Name: "My sweat sensor",
100+
Unit: "kWh",
101+
Icon: "hassio-icon",
107102
}},
108103
},
109104
},

0 commit comments

Comments
 (0)