Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use matter-snap-testing to handle log files #74

Merged
merged 12 commits into from
Aug 7, 2024
Prev Previous commit
Next Next commit
Change WriteLogFile to accept a string
jpm-canonical committed Aug 2, 2024
commit 8712719cdb2ba8b1c98b0fcc0526188035eafed1
4 changes: 2 additions & 2 deletions tests/thread_tests/thread_test.go
Original file line number Diff line number Diff line change
@@ -18,14 +18,14 @@ func TestAllClustersAppThread(t *testing.T) {
t.Run("Commission", func(t *testing.T) {
stdout, _, _ := utils.Exec(t, "chip-tool pairing code-thread 110 hex:"+trimmedActiveDataset+" 34970112332 2>&1")

assert.NoError(t, utils.WriteLogFile(t, "chip-tool-thread-pairing", []byte(stdout)))
assert.NoError(t, utils.WriteLogFile(t, "chip-tool-thread-pairing", stdout))
jpm-canonical marked this conversation as resolved.
Show resolved Hide resolved
})

t.Run("Control", func(t *testing.T) {
start := time.Now()
stdout, _, _ := utils.Exec(t, "chip-tool onoff toggle 110 1 2>&1")

assert.NoError(t, utils.WriteLogFile(t, "chip-tool-thread-onoff", []byte(stdout)))
assert.NoError(t, utils.WriteLogFile(t, "chip-tool-thread-onoff", stdout))

// 0x6 is the Matter Cluster ID for on-off
// Using cluster ID here because of a buffering issue in the log stream:
6 changes: 3 additions & 3 deletions tests/upgrade_test.go
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ func TestUpgrade(t *testing.T) {

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, "chip-tool-pairing", []byte(stdout)))
assert.NoError(t, utils.WriteLogFile(t, "chip-tool-pairing", stdout))
})

t.Run("Control before upgrade", func(t *testing.T) {
@@ -58,7 +58,7 @@ func TestUpgrade(t *testing.T) {

start := time.Now()
stdout, _, _ := utils.Exec(t, "chip-tool onoff on 110 1 2>&1")
assert.NoError(t, utils.WriteLogFile(t, "chip-tool-onoff", []byte(stdout)))
assert.NoError(t, utils.WriteLogFile(t, "chip-tool-onoff", stdout))

waitForOnOffHandlingByAllClustersApp(t, start)
})
@@ -78,7 +78,7 @@ func TestUpgrade(t *testing.T) {

start := time.Now()
stdout, _, _ := utils.Exec(t, "chip-tool onoff off 110 1 2>&1")
assert.NoError(t, utils.WriteLogFile(t, "chip-tool-onoff", []byte(stdout)))
assert.NoError(t, utils.WriteLogFile(t, "chip-tool-onoff", stdout))

waitForOnOffHandlingByAllClustersApp(t, start)
})
4 changes: 2 additions & 2 deletions tests/wifi_test.go
Original file line number Diff line number Diff line change
@@ -36,12 +36,12 @@ func TestAllClustersAppWiFi(t *testing.T) {

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, "chip-tool-pairing", []byte(stdout)))
assert.NoError(t, utils.WriteLogFile(t, "chip-tool-pairing", 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, "chip-tool-toggle", []byte(stdout)))
assert.NoError(t, utils.WriteLogFile(t, "chip-tool-toggle", stdout))

waitForOnOffHandlingByAllClustersApp(t, start)
})