Skip to content

Commit

Permalink
tests/main/cohorts: replace yq with a Python snippet
Browse files Browse the repository at this point in the history
The yq tool changed its command line arguments and the test broke. Try not to
depend on external tools and use a simple Python snippet to extract the cohort key.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
  • Loading branch information
bboozzoo authored and anonymouse64 committed Jan 12, 2021
1 parent 4d3de63 commit e544986
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/main/cohorts/task.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
summary: Check that cohorts work

prepare: |
snap install yq
snap connect yq:home
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh
debug: |
cat coh.yml || true
execute: |
echo "Test we can create chorts:"
snap create-cohort test-snapd-tools > coh.yml
COHORT=$( yq r coh.yml cohorts.test-snapd-tools.cohort-key )
# the YAML looks like this:
# cohorts:
# test-snapd-tools:
# cohort-key: <key>
COHORT=$(test-snapd-sh.cmd python3 -c 'import sys, yaml; print(yaml.safe_load(sys.stdin)["cohorts"]["test-snapd-tools"]["cohort-key"])' < coh.yml)
test -n "$COHORT"
echo "Test we can install from there:"
Expand Down

0 comments on commit e544986

Please sign in to comment.