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

Add Automated testing workflow #45

Merged
merged 92 commits into from
Feb 20, 2024

Conversation

locnnil
Copy link
Contributor

@locnnil locnnil commented Feb 5, 2024

  • Added a test for the matter-pi-gpio-commander.test-blink application.
  • Added a test for the lighting-app application using the Wi-Fi method.
  • Utilized the GPIO Testing Driver to mock GPIOs.

locnnil and others added 8 commits February 5, 2024 09:38
- Added action to use SSH to debug workflow
- Add download artifact action

Signed-off-by: Lincoln Wallace <[email protected]>
Signed-off-by: Lincoln Wallace <[email protected]>
Fetching modifications made on library replacement branch into the creation of automated testing branch

Signed-off-by: Lincoln Wallace <[email protected]>
Signed-off-by: Lincoln Wallace <[email protected]>
Signed-off-by: Lincoln Wallace <[email protected]>
Co-authored-by: Farshid Tavakolizadeh <[email protected]>
@farshidtz farshidtz changed the base branch from main to chardev February 6, 2024 15:17
@locnnil locnnil force-pushed the IENG-884-automated-test-workflow branch from 05d2ab3 to 0a5283f Compare February 6, 2024 16:33
Signed-off-by: Lincoln Wallace <[email protected]>
- Put SSH action to the end
- Run chmod mod to add executable permission to gpio-mock.sh script
- Run QEMU for arm64

Signed-off-by: Lincoln Wallace <[email protected]>
Add integration tests and documentation
Test for standard blink application

Signed-off-by: Lincoln Wallace <[email protected]>
@locnnil locnnil force-pushed the IENG-884-automated-test-workflow branch 2 times, most recently from b83d5d7 to 334e6f4 Compare February 7, 2024 19:04
tests/snap_test.go Outdated Show resolved Hide resolved
tests/snap_test.go Outdated Show resolved Hide resolved
tests/snap_test.go Outdated Show resolved Hide resolved
.github/workflows/build-and-test-snap.yml Outdated Show resolved Hide resolved
tests/snap_test.go Outdated Show resolved Hide resolved
@locnnil locnnil force-pushed the IENG-884-automated-test-workflow branch from c19f1ef to 8d34588 Compare February 19, 2024 19:56
Signed-off-by: Lincoln Wallace <[email protected]>
Signed-off-by: Lincoln Wallace <[email protected]>
Signed-off-by: Lincoln Wallace <[email protected]>
Signed-off-by: Lincoln Wallace <[email protected]>
Signed-off-by: Lincoln Wallace <[email protected]>
tests/snap_test.go Outdated Show resolved Hide resolved
@locnnil locnnil requested a review from farshidtz February 19, 2024 23:29
Copy link
Member

@farshidtz farshidtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with some minor comments. Thanks

I tested it on a Raspberry Pi 5:

$ GPIO_CHIP=4 GPIO_LINE=4 go test -v -failfast -count 1
go: downloading github.com/stretchr/testify v1.8.4
go: downloading github.com/canonical/matter-snap-testing v1.0.0-beta.1
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.1
2024/02/20 08:55:55 [CLEAN]
2024/02/20 08:55:55 [exec] sudo snap remove --purge matter-pi-gpio-commander
2024/02/20 08:55:59 [stdout] matter-pi-gpio-commander removed
2024/02/20 08:55:59 [exec] sudo snap remove --purge chip-tool
2024/02/20 08:55:59 [stderr] snap "chip-tool" is not installed
2024/02/20 08:55:59 [SETUP]
2024/02/20 08:55:59 [exec] sudo snap install matter-pi-gpio-commander --channel=latest/edge
2024/02/20 08:56:08 [stdout] matter-pi-gpio-commander (edge) 2.0.0 from Canonical IoT Labs installed
2024/02/20 08:56:08 [exec] sudo snap set matter-pi-gpio-commander gpiochip='4'
2024/02/20 08:56:08 [exec] sudo snap set matter-pi-gpio-commander gpio='4'
2024/02/20 08:56:08 [exec] sudo snap connect matter-pi-gpio-commander:avahi-control 
2024/02/20 08:56:09 [exec] sudo snap connect matter-pi-gpio-commander:bluez 
2024/02/20 08:56:10 [exec] sudo snap connect matter-pi-gpio-commander:network 
2024/02/20 08:56:10 [exec] sudo snap connect matter-pi-gpio-commander:network-bind 
2024/02/20 08:56:10 [exec] sudo snap connect matter-pi-gpio-commander:custom-gpio matter-pi-gpio-commander:custom-gpio-dev
=== RUN   TestBlinkOperation
    snap_test.go:205: [exec] sudo matter-pi-gpio-commander.test-blink
    exec.go:140: [stdout] GPIO: 4
    exec.go:140: [stdout] GPIOCHIP: 4
    exec.go:140: [stdout] On
    exec.go:140: [stdout] Off
    exec.go:140: [stdout] On
    exec.go:140: [stdout] Off
    exec.go:140: [stdout] On
    exec.go:140: [stdout] Off
    exec.go:140: [stdout] On
    exec.go:140: [stdout] Off
    exec.go:140: [stdout] On
--- PASS: TestBlinkOperation (5.00s)
=== RUN   TestWifiMatterCommander
    snap.go:28: [exec] sudo snap install chip-tool --channel=latest/edge
    exec.go:140: [stdout] chip-tool (edge) v1.2.0.1+snap from Canonical IoT Labs installed
2024/02/20 08:56:19 [exec] sudo snap connect chip-tool:avahi-observe 
    snap.go:161: [exec] sudo snap start --enable matter-pi-gpio-commander
    exec.go:140: [stdout] Started.
=== RUN   TestWifiMatterCommander/Commission
    snap_test.go:233: [exec] sudo chip-tool pairing onnetwork 110 20202021
    snap_test.go:235: stderr: 
=== RUN   TestWifiMatterCommander/Control
    snap_test.go:240: [exec] sudo chip-tool onoff toggle 110 1
    snap_test.go:240: [exec] sudo chip-tool onoff toggle 110 1
    snap_test.go:240: [exec] sudo chip-tool onoff toggle 110 1
    snap_test.go:240: [exec] sudo chip-tool onoff toggle 110 1
--- PASS: TestWifiMatterCommander (7.47s)
    --- PASS: TestWifiMatterCommander/Commission (0.78s)
    --- PASS: TestWifiMatterCommander/Control (1.75s)
PASS
2024/02/20 08:56:23 [TEARDOWN]
2024/02/20 08:56:23 [exec] (sudo journalctl --since "2024-02-20 08:55:55" --no-pager | grep "matter-pi-gpio-commander"|| true) > matter-pi-gpio-commander.log
Wrote snap logs to /home/ubuntu/matter-pi-gpio-commander/tests/matter-pi-gpio-commander.log
2024/02/20 08:56:23 [exec] rm 
2024/02/20 08:56:23 Removing installed snap: true
2024/02/20 08:56:23 [exec] sudo snap remove --purge matter-pi-gpio-commander
2024/02/20 08:56:29 [stdout] matter-pi-gpio-commander removed
2024/02/20 08:56:29 [exec] sudo snap remove --purge chip-tool
2024/02/20 08:56:33 [stdout] chip-tool removed
2024/02/20 08:56:33 [exec] ./gpio-mock.sh teardown
ok  	matter-pi-gpio-commander-tests	38.208s

tests/snap_test.go Outdated Show resolved Hide resolved
tests/snap_test.go Outdated Show resolved Hide resolved
tests/snap_test.go Outdated Show resolved Hide resolved
tests/snap_test.go Show resolved Hide resolved
tests/snap_test.go Outdated Show resolved Hide resolved
tests/snap_test.go Show resolved Hide resolved
tests/snap_test.go Show resolved Hide resolved
@locnnil locnnil added the CI Continuous Integration label Feb 20, 2024
@farshidtz farshidtz merged commit 250875c into canonical:main Feb 20, 2024
2 checks passed
@locnnil locnnil deleted the IENG-884-automated-test-workflow branch March 27, 2024 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants