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

refactor(snap): edgex-snap-hooks related upgrade #101

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

MonicaisHer
Copy link
Contributor

@MonicaisHer MonicaisHer commented Jul 21, 2022

This PR upgrades snap hooks to 2.4.1 with new function and refactor:

  • Combine install hook and configure hook
  • Use library function for copying directory
  • Remove export bash command to process valid .env files
  • Use log package for logging
  • Use library function for autostart processing

Signed-off-by: Mengyi Wang mengyi.wang@canonical.com

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/device-rfid-llrp-go/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?) device-rfid-llrp test suite passed with FULL_CONFIG_TEST=true
  • I have opened a PR for the related docs change (if not, why?)

Testing Instructions

  1. Install and validate that all config files have been copied in right place:
tree /var/snap/edgex-device-rfid-llrp/current/config
.
└── device-rfid-llrp
    └── res
        ├── configuration.toml
        ├── devices
        ├── profiles
        │   ├── llrp.device.profile.yaml
        │   └── llrp.impinj.profile.yaml
        └── provision_watchers
            ├── impinj.provision.watcher.json
            └── llrp.provision.watcher.json

5 directories, 5 files
  1. Setup and start:
sudo snap set edgex-device-rfid-llrp app-options=true
sudo snap set edgex-device-rfid-llrp config.writable-loglevel=DEBUG
sudo snap set edgex-device-rfid-llrp config.service-startupmsg="#test start up message#"
sudo snap start edgex-device-rfid-llrp
  1. Check the .env file is valid now without export command:
cat /var/snap/edgex-device-rfid-llrp/current/config/device-rfid-llrp/res/device-rfid-llrp.env 

SERVICE_STARTUPMSG="#test start up message#"
WRITABLE_LOGLEVEL="DEBUG"
  1. Validate env vars in .env have been exported successfully:
sudo snap logs -f edgex-device-rfid-llrp

msg="#test start up message#"
level=DEBUG msg="xxx"
  1. Validate autostart via snap option works:
$ sudo snap set edgex-device-rfid-llrp autostart=true
$ snap services edgex-device-rfid-llrp
Service                                  Startup  Current  Notes
edgex-device-rfid-llrp.device-rfid-llrp  enabled  active   -

$ sudo snap set edgex-device-rfid-llrp autostart=false
$ snap services edgex-device-rfid-llrp
Service                                  Startup   Current   Notes
edgex-device-rfid-llrp.device-rfid-llrp  disabled  inactive  -

New Dependency Instructions (If applicable)

Signed-off-by: Mengyi Wang <mengyi.wang@canonical.com>
Signed-off-by: Mengyi Wang <mengyi.wang@canonical.com>
@codecov-commenter
Copy link

Codecov Report

Merging #101 (01af92c) into main (671ea72) will increase coverage by 0.03%.
The diff coverage is n/a.

❗ Current head 01af92c differs from pull request most recent head 1e887eb. Consider uploading reports for the commit 1e887eb to get more accurate results

@@            Coverage Diff             @@
##             main     #101      +/-   ##
==========================================
+ Coverage   41.12%   41.16%   +0.03%     
==========================================
  Files          21       21              
  Lines        9016     9016              
==========================================
+ Hits         3708     3711       +3     
+ Misses       4140     4138       -2     
+ Partials     1168     1167       -1     
Impacted Files Coverage Δ
internal/llrp/reader.go 41.24% <0.00%> (+0.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 671ea72...1e887eb. Read the comment docs.

@MonicaisHer MonicaisHer marked this pull request as ready for review July 22, 2022 07:06
@farshidtz farshidtz self-requested a review July 25, 2022 08:38
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.

Thanks. Looks good.

@farshidtz farshidtz merged commit 5edf930 into edgexfoundry:main Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants