Skip to content

Commit

Permalink
Run chip-tool commands without sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
farshidtz committed Jul 5, 2024
1 parent b406880 commit 3d8f560
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tests/thread_tests/thread_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ func TestAllClustersAppThread(t *testing.T) {
remote_setup(t)

t.Run("Commission", func(t *testing.T) {
stdout, _, _ := utils.Exec(t, "sudo chip-tool pairing code-thread 110 hex:"+trimmedActiveDataset+" 34970112332 2>&1")
stdout, _, _ := utils.Exec(t, "chip-tool pairing code-thread 110 hex:"+trimmedActiveDataset+" 34970112332 2>&1")
assert.NoError(t,
os.WriteFile("chip-tool-thread-pairing.log", []byte(stdout), 0644),
)
})

t.Run("Control", func(t *testing.T) {
start := time.Now()
stdout, _, _ := utils.Exec(t, "sudo chip-tool onoff toggle 110 1 2>&1")
stdout, _, _ := utils.Exec(t, "chip-tool onoff toggle 110 1 2>&1")
assert.NoError(t,
os.WriteFile("chip-tool-thread-onoff.log", []byte(stdout), 0644),
)
Expand Down
6 changes: 3 additions & 3 deletions tests/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestUpgrade(t *testing.T) {
allClustersSnap, "CHIP minimal mDNS started advertising", start)

t.Run("Commission", func(t *testing.T) {
stdout, _, _ := utils.Exec(t, "sudo chip-tool pairing onnetwork 110 20202021 2>&1")
stdout, _, _ := utils.Exec(t, "chip-tool pairing onnetwork 110 20202021 2>&1")
writeLogFile(t, "chip-tool-pairing", []byte(stdout))
})

Expand All @@ -54,7 +54,7 @@ func TestUpgrade(t *testing.T) {
log.Printf("%s installed version %s build %s\n", chipToolSnap, snapVersion, snapRevision)

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

waitForOnOffHandlingByAllClustersApp(t, start)
Expand All @@ -74,7 +74,7 @@ func TestUpgrade(t *testing.T) {
log.Printf("%s installed version %s build %s\n", chipToolSnap, snapVersion, snapRevision)

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

waitForOnOffHandlingByAllClustersApp(t, start)
Expand Down
4 changes: 2 additions & 2 deletions tests/wifi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ func TestAllClustersAppWiFi(t *testing.T) {
allClustersSnap, "CHIP minimal mDNS started advertising", start)

t.Run("Commission", func(t *testing.T) {
stdout, _, _ := utils.Exec(t, "sudo chip-tool pairing onnetwork 110 20202021 2>&1")
stdout, _, _ := utils.Exec(t, "chip-tool pairing onnetwork 110 20202021 2>&1")
writeLogFile(t, "chip-tool-pairing", []byte(stdout))
})

t.Run("Control", func(t *testing.T) {
stdout, _, _ := utils.Exec(t, "sudo chip-tool onoff toggle 110 1 2>&1")
stdout, _, _ := utils.Exec(t, "chip-tool onoff toggle 110 1 2>&1")
writeLogFile(t, "chip-tool-toggle", []byte(stdout))

waitForOnOffHandlingByAllClustersApp(t, start)
Expand Down

0 comments on commit 3d8f560

Please sign in to comment.