-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwifi_test.go
49 lines (36 loc) · 1.23 KB
/
wifi_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package tests
import (
"testing"
"time"
"github.com/canonical/matter-snap-testing/utils"
"github.com/stretchr/testify/assert"
)
func TestAllClustersAppWiFi(t *testing.T) {
InstallChipTool(t)
start := time.Now()
// Start clean
utils.SnapRemove(t, allClustersSnap)
t.Cleanup(func() {
utils.SnapDumpLogs(t, start, allClustersSnap)
utils.SnapRemove(t, allClustersSnap)
})
// Install all clusters app
utils.SnapInstallFromStore(t, allClustersSnap, "latest/beta")
// Setup all clusters app
utils.SnapSet(t, allClustersSnap, "args", "--wifi")
utils.SnapConnect(t, allClustersSnap+":avahi-control", "")
utils.SnapConnect(t, allClustersSnap+":bluez", "")
// Start all clusters app
utils.SnapStart(t, allClustersSnap)
utils.WaitForLogMessage(t,
allClustersSnap, "CHIP minimal mDNS started advertising", start)
t.Run("Commission", func(t *testing.T) {
stdout, _, _ := utils.Exec(t, "chip-tool pairing onnetwork 110 20202021 2>&1")
assert.NoError(t, utils.WriteLogFile(t, chipToolSnap, stdout))
})
t.Run("Control", func(t *testing.T) {
stdout, _, _ := utils.Exec(t, "chip-tool onoff toggle 110 1 2>&1")
assert.NoError(t, utils.WriteLogFile(t, chipToolSnap, stdout))
waitForOnOffHandlingByAllClustersApp(t, start)
})
}