Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Refactor tests to use latest utils and new env packages
  • Loading branch information
jpm-canonical committed Aug 1, 2024
1 parent 0e19ef0 commit b3b9577
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
7 changes: 4 additions & 3 deletions tests/common.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tests

import (
"github.com/canonical/matter-snap-testing/env"
"os"
"strings"
"testing"
Expand All @@ -19,13 +20,13 @@ func InstallChipTool(t *testing.T) {
// clean
utils.SnapRemove(t, chipToolSnap)

if utils.LocalServiceSnap() {
if env.SnapPath() != "" {
require.NoError(t,
utils.SnapInstallFromFile(nil, utils.LocalServiceSnapPath),
utils.SnapInstallFromFile(nil, env.SnapPath()),
)
} else {
require.NoError(t,
utils.SnapInstallFromStore(nil, chipToolSnap, utils.ServiceChannel),
utils.SnapInstallFromStore(nil, chipToolSnap, env.SnapChannel()),
)
}
t.Cleanup(func() {
Expand Down
8 changes: 4 additions & 4 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ module chip-tool-snap-tests
go 1.21.6

require (
github.com/canonical/matter-snap-testing v1.0.0-beta.1
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.20.0
github.com/canonical/matter-snap-testing v1.0.0-beta.3
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.25.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/sys v0.22.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 8 additions & 2 deletions tests/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/canonical/matter-snap-testing v1.0.0-beta.1 h1:obxh5jYRWgCw6QNax4+aY571h+q/zcPZBOP64gwd56E=
github.com/canonical/matter-snap-testing v1.0.0-beta.1/go.mod h1:800wP9+ux8DW9Xr9QvlIdxFHlu85mqlhvlA2JO20aeQ=
github.com/canonical/matter-snap-testing v1.0.0-beta.3 h1:3xkKcc/jhGendCGBZaYjANRJE9yC2mdO5RWt3A4nUzM=
github.com/canonical/matter-snap-testing v1.0.0-beta.3/go.mod h1:800wP9+ux8DW9Xr9QvlIdxFHlu85mqlhvlA2JO20aeQ=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -11,10 +11,16 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
3 changes: 2 additions & 1 deletion tests/thread_tests/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package thread_tests

import (
"fmt"
"github.com/canonical/matter-snap-testing/env"
"os"
"strings"
"testing"
Expand All @@ -19,7 +20,7 @@ func setup(t *testing.T) {
utils.SnapRemove(t, otbrSnap)

// Install OTBR
utils.SnapInstallFromStore(t, otbrSnap, utils.ServiceChannel)
utils.SnapInstallFromStore(t, otbrSnap, env.SnapChannel())
t.Cleanup(func() {
utils.SnapRemove(t, otbrSnap)
})
Expand Down
7 changes: 4 additions & 3 deletions tests/upgrade_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tests

import (
"github.com/canonical/matter-snap-testing/env"
"log"
"testing"
"time"
Expand Down Expand Up @@ -31,7 +32,7 @@ func TestUpgrade(t *testing.T) {
utils.SnapConnect(t, chipToolSnap+":process-control", "")

// Install all clusters app
utils.SnapInstallFromStore(t, allClustersSnap, utils.ServiceChannel)
utils.SnapInstallFromStore(t, allClustersSnap, env.SnapChannel())

// Setup all clusters app
utils.SnapSet(t, allClustersSnap, "args", "--wifi")
Expand Down Expand Up @@ -61,8 +62,8 @@ func TestUpgrade(t *testing.T) {
})

t.Run("Upgrade snap", func(t *testing.T) {
if utils.LocalServiceSnap() {
utils.SnapInstallFromFile(t, utils.LocalServiceSnapPath)
if env.SnapPath() != "" {
utils.SnapInstallFromFile(t, env.SnapPath())
} else {
utils.SnapRefresh(t, chipToolSnap, "latest/edge")
}
Expand Down

0 comments on commit b3b9577

Please sign in to comment.