Merge ~sylvain-pineau/checkbox-provider-edgex:multi-release-layout into ~checkbox-dev/checkbox-provider-edgex:master

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: c84f3e3750c00900f298d8691ecddcfa11547802
Merged at revision: 6df22cbebcb9f8ead29b0390db5a5f6ca23bc09a
Proposed branch: ~sylvain-pineau/checkbox-provider-edgex:multi-release-layout
Merge into: ~checkbox-dev/checkbox-provider-edgex:master
Diff against target: 1554 lines (+1314/-22)
19 files modified
data/geneva/run-all-tests-locally.sh (+154/-0)
data/geneva/test-dbtype-mongo.sh (+98/-0)
data/geneva/test-dbtype-redis.sh (+140/-0)
data/geneva/test-device-virtual.sh (+104/-0)
data/geneva/test-install-config-paths.sh (+49/-0)
data/geneva/test-install.sh (+23/-0)
data/geneva/test-refresh-config-paths.sh (+87/-0)
data/geneva/test-refresh-services.sh (+61/-0)
data/geneva/test-security-services-proxy-certs.sh (+46/-0)
data/geneva/test-self-refresh-services.sh (+56/-0)
data/geneva/test-services-alive.sh (+32/-0)
data/geneva/test-sys-mgmt-agent.sh (+84/-0)
data/geneva/utils.sh (+296/-0)
data/hanoi/placeholder.txt (+0/-0)
data/ireland/placeholder.txt (+0/-0)
data/jakarta/placeholder.txt (+0/-0)
units/fuji.pxu (+18/-18)
units/geneva.pxu (+55/-0)
units/test-plan.pxu (+11/-4)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+382668@code.launchpad.net

Description of the change

Adopt a multi release layout instead of managing multiple branches/versions/tracks of the same snap. This is a working model inspired by what we've been using for the tpm2 provider [1].

Both Fuji and Geneva tests and test plan are coexisting and scripts have been transferred to the data/ dir.

New launchers are available for the two releases and the existing test-runner now loads the geneva test plan.

[1] https://git.launchpad.net/plainbox-provider-tpm2/tree/data

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

self-approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/run-all-tests-locally.sh b/data/fuji/run-all-tests-locally.sh
2similarity index 100%
3rename from bin/run-all-tests-locally.sh
4rename to data/fuji/run-all-tests-locally.sh
5diff --git a/bin/test-dbtype-mongo.sh b/data/fuji/test-dbtype-mongo.sh
6similarity index 100%
7rename from bin/test-dbtype-mongo.sh
8rename to data/fuji/test-dbtype-mongo.sh
9diff --git a/bin/test-dbtype-redis.sh b/data/fuji/test-dbtype-redis.sh
10similarity index 100%
11rename from bin/test-dbtype-redis.sh
12rename to data/fuji/test-dbtype-redis.sh
13diff --git a/bin/test-device-random.sh b/data/fuji/test-device-random.sh
14similarity index 100%
15rename from bin/test-device-random.sh
16rename to data/fuji/test-device-random.sh
17diff --git a/bin/test-device-virtual.sh b/data/fuji/test-device-virtual.sh
18similarity index 100%
19rename from bin/test-device-virtual.sh
20rename to data/fuji/test-device-virtual.sh
21diff --git a/bin/test-install-config-paths.sh b/data/fuji/test-install-config-paths.sh
22similarity index 100%
23rename from bin/test-install-config-paths.sh
24rename to data/fuji/test-install-config-paths.sh
25diff --git a/bin/test-install.sh b/data/fuji/test-install.sh
26similarity index 100%
27rename from bin/test-install.sh
28rename to data/fuji/test-install.sh
29diff --git a/bin/test-push-config.sh b/data/fuji/test-push-config.sh
30similarity index 100%
31rename from bin/test-push-config.sh
32rename to data/fuji/test-push-config.sh
33diff --git a/bin/test-refresh-config-paths.sh b/data/fuji/test-refresh-config-paths.sh
34similarity index 100%
35rename from bin/test-refresh-config-paths.sh
36rename to data/fuji/test-refresh-config-paths.sh
37diff --git a/bin/test-refresh-services.sh b/data/fuji/test-refresh-services.sh
38similarity index 100%
39rename from bin/test-refresh-services.sh
40rename to data/fuji/test-refresh-services.sh
41diff --git a/bin/test-security-services-proxy-certs.sh b/data/fuji/test-security-services-proxy-certs.sh
42similarity index 100%
43rename from bin/test-security-services-proxy-certs.sh
44rename to data/fuji/test-security-services-proxy-certs.sh
45diff --git a/bin/test-self-refresh-services.sh b/data/fuji/test-self-refresh-services.sh
46similarity index 100%
47rename from bin/test-self-refresh-services.sh
48rename to data/fuji/test-self-refresh-services.sh
49diff --git a/bin/test-services-alive.sh b/data/fuji/test-services-alive.sh
50similarity index 100%
51rename from bin/test-services-alive.sh
52rename to data/fuji/test-services-alive.sh
53diff --git a/bin/test-sys-mgmt-agent.sh b/data/fuji/test-sys-mgmt-agent.sh
54similarity index 100%
55rename from bin/test-sys-mgmt-agent.sh
56rename to data/fuji/test-sys-mgmt-agent.sh
57diff --git a/bin/utils.sh b/data/fuji/utils.sh
58similarity index 100%
59rename from bin/utils.sh
60rename to data/fuji/utils.sh
61diff --git a/data/geneva/run-all-tests-locally.sh b/data/geneva/run-all-tests-locally.sh
62new file mode 100755
63index 0000000..e297db1
64--- /dev/null
65+++ b/data/geneva/run-all-tests-locally.sh
66@@ -0,0 +1,154 @@
67+#!/bin/bash -e
68+
69+# get the directory of this script
70+# snippet from https://stackoverflow.com/a/246128/10102404
71+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
72+
73+if [ "$(id -u)" != "0" ]; then
74+ echo "script must be run as root"
75+ exit 1
76+fi
77+
78+# load the utils
79+# shellcheck source=/dev/null
80+source "$SCRIPT_DIR/utils.sh"
81+
82+# helper function to download the snap, ack the assertion and return the
83+# name of the file
84+snap_download_and_ack()
85+{
86+ # download the snap and grep the output for the assert file so we can ack
87+ # it
88+ snap_download_output=$(snap download "$1" "$2")
89+ $SUDO snap ack "$(echo "$snap_download_output" | grep -Po 'edgexfoundry_[0-9]+\.assert')"
90+ # return the name of this snap
91+ echo "$(pwd)"/"$(echo "$snap_download_output" | grep -Po 'edgexfoundry_[0-9]+\.snap')"
92+}
93+
94+snap_download_stable_and_last()
95+{
96+ # download and ack the stable and edinburgh channels as we have tests to ensure
97+ # there's a smooth upgrade between those channels and this one that is
98+ # under consideration
99+ # this also saves in download bandwidth and time
100+ EDGEX_STABLE_SNAP_FILE=$(snap_download_and_ack edgexfoundry --stable)
101+ EDGEX_EDINBURGH_SNAP_FILE=$(snap_download_and_ack edgexfoundry --channel=edinburgh)
102+
103+ # export the names of the stable and delhi snap files
104+ export EDGEX_STABLE_SNAP_FILE
105+ export EDGEX_EDINBURGH_SNAP_FILE
106+}
107+
108+# parse arguments - adapted from https://stackoverflow.com/a/14203146/10102404
109+POSITIONAL=()
110+while [[ $# -gt 0 ]]; do
111+ key="$1"
112+ case $key in
113+ -h|--help)
114+ echo "usage:"
115+ echo "run-all-tests-locally.sh [OPTIONS]"
116+ echo "options:"
117+ printf -- "-s|--snap SNAP\t local snap file to test\n"
118+ printf -- "-t|--test TEST\t run single test\n"
119+ printf -- "-v|--verbose\t show output of tests even if passed\n"
120+ printf -- "-i|--ignorefail\t continue running tests even if some fail\n"
121+ exit 0
122+ ;;
123+ -s|--snap)
124+ LOCAL_SNAP="$2"
125+ shift # past argument
126+ shift # past value
127+ ;;
128+ -t|--test)
129+ SINGLE_TEST="$2"
130+ shift # past argument
131+ shift # past value
132+ ;;
133+ -v|--verbose)
134+ VERBOSE=YES
135+ shift # past argument
136+ ;;
137+ -i|--ignorefail)
138+ IGNORE_FAIL=YES
139+ shift # past argument
140+ ;;
141+ *) # unknown option
142+ POSITIONAL+=("$1") # save it in an array for later
143+ shift # past argument
144+ ;;
145+ esac
146+done
147+set -- "${POSITIONAL[@]}" # restore positional parameters
148+
149+# if an argument was provided to the script, it's supposed to be a local snap
150+# file to test - confirm that the file exists
151+# otherwise if we didn't get any arguments assume to test the snap from beta
152+if [[ -n $LOCAL_SNAP ]]; then
153+ if [ -f "$LOCAL_SNAP" ]; then
154+ echo "testing local snap: $LOCAL_SNAP"
155+ REVISION_TO_TEST=$LOCAL_SNAP
156+ REVISION_TO_TEST_CHANNEL=""
157+ # for now always need to test edgexfoundry locally with devmode
158+ # because we can't auto-connect interfaces that are needed
159+ REVISION_TO_TEST_CONFINEMENT="--devmode"
160+ else
161+ echo "local snap to test: \"$LOCAL_SNAP\" does not exist"
162+ exit 1
163+ fi
164+else
165+ REVISION_TO_TEST=$(snap_download_and_ack edgexfoundry --beta)
166+ REVISION_TO_TEST_CHANNEL=""
167+ REVISION_TO_TEST_CONFINEMENT=""
168+fi
169+
170+# export the revision to test env vars
171+export REVISION_TO_TEST
172+export REVISION_TO_TEST_CHANNEL
173+export REVISION_TO_TEST_CONFINEMENT
174+
175+# make sure to remove the snap if it's installed before running
176+snap_remove 2>/dev/null > /dev/null
177+
178+set +e
179+if [ -n "$SINGLE_TEST" ]; then
180+ printf "running single test: %s ..." "$SINGLE_TEST"
181+
182+ if [ "$SINGLE_TEST" == "test-refresh-config-paths.sh" ] ||
183+ [ "$SINGLE_TEST" == "test-refresh-services.sh" ]; then
184+ snap_download_stable_and_last
185+ fi
186+
187+ if stdout="$("$SCRIPT_DIR/$SINGLE_TEST" 2>&1)"; then
188+ printf -- "\tPASSED\n"
189+ if [ -n "$VERBOSE" ]; then
190+ echo "$stdout"
191+ fi
192+ else
193+ printf -- "\tFAILED:\n"
194+ echo "$stdout"
195+ exit 1
196+ fi
197+else
198+ snap_download_stable_and_last
199+
200+ # run all the tests (except this file obviously)
201+ for file in "$SCRIPT_DIR"/test-*.sh; do
202+ printf "running test: %s..." "$file"
203+ if stdout="$($file 2>&1)"; then
204+ printf "\t\tPASSED\n"
205+ if [ -n "$VERBOSE" ]; then
206+ echo "$stdout"
207+ fi
208+ else
209+ printf "\t\tFAILED:\n"
210+ echo "$stdout"
211+ if [ -z "$IGNORE_FAIL" ]; then
212+ snap_remove
213+ exit 1
214+ fi
215+ fi
216+ done
217+fi
218+
219+# finally remove the snap if it's still there
220+snap_remove 2>/dev/null > /dev/null
221diff --git a/data/geneva/test-dbtype-mongo.sh b/data/geneva/test-dbtype-mongo.sh
222new file mode 100755
223index 0000000..1775815
224--- /dev/null
225+++ b/data/geneva/test-dbtype-mongo.sh
226@@ -0,0 +1,98 @@
227+#!/bin/bash -e
228+
229+# get the directory of this script
230+# snippet from https://stackoverflow.com/a/246128/10102404
231+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
232+
233+# load the utils
234+# shellcheck source=/dev/null
235+source "$SCRIPT_DIR/utils.sh"
236+
237+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
238+
239+snap_remove
240+
241+# install the snap to make sure it installs
242+if [ -n "$REVISION_TO_TEST" ]; then
243+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
244+else
245+ snap_install edgexfoundry "$DEFAULT_TEST_CHANNEL"
246+fi
247+
248+echo -n "finding jq... "
249+
250+set +e
251+if command -v edgexfoundry.jq > /dev/null; then
252+ JQ=$(command -v edgexfoundry.jq)
253+elif command -v jq > /dev/null; then
254+ JQ=$(command -v jq)
255+else
256+ echo "NOT FOUND"
257+ echo "install with snap install jq"
258+ exit 1
259+fi
260+
261+echo "found at $JQ"
262+
263+echo -n "finding toml2json... "
264+
265+set +e
266+if ! command -v toml2json > /dev/null; then
267+ echo "NOT FOUND"
268+ echo "install with \`snap install remarshal\`"
269+ exit 1
270+fi
271+
272+echo "found at $(command -v toml2json)"
273+
274+# wait for services to start up
275+sleep 120
276+
277+# set to redis, assume that this change works, it's tested already elsewhere
278+snap set edgexfoundry dbtype=redis
279+sleep 15
280+
281+# set back to mongo now
282+snap set edgexfoundry dbtype=mongodb
283+sleep 15
284+
285+# check that the config files use mongo now
286+for svc in core-data core-metadata export-client support-notifications support-scheduler; do
287+ # the type should be mongodb
288+ if [ "$(toml2json < "/var/snap/edgexfoundry/current/config/$svc/res/configuration.toml" | jq -r '.Databases.Primary.Type')" != "mongodb" ]; then
289+ echo "incorrect setting for $svc primary database type after changing to mongo"
290+ exit 1
291+ fi
292+ # the port should be 27017
293+ if [ "$(toml2json < "/var/snap/edgexfoundry/current/config/$svc/res/configuration.toml" | jq -r '.Databases.Primary.Port')" != "27017" ]; then
294+ echo "incorrect setting for $svc primary database port after changing to mongo"
295+ exit 1
296+ fi
297+done
298+
299+# ensure mongod is running
300+if [ -n "$(snap services edgexfoundry.mongod | grep edgexfoundry.mongod | grep inactive)" ]; then
301+ echo "mongod is not running after changing to mongo"
302+ exit 1
303+fi
304+
305+# ensure mongod is enabled
306+if [ -z "$(snap services edgexfoundry.mongod | grep edgexfoundry.mongod | grep enabled)" ]; then
307+ echo "mongod is not enabled after changing to mongo"
308+ exit 1
309+fi
310+
311+# ensure redis is not running
312+if [ -z "$(snap services edgexfoundry.redis | grep edgexfoundry.redis | grep inactive)" ]; then
313+ echo "redis is running after changing to mongo"
314+ exit 1
315+fi
316+
317+# ensure redis is disabled
318+if [ -z "$(snap services edgexfoundry.redis | grep edgexfoundry.redis | grep disabled)" ]; then
319+ echo "redis is enabled after changing to mongo"
320+ exit 1
321+fi
322+
323+# remove the snap to run again
324+snap_remove
325diff --git a/data/geneva/test-dbtype-redis.sh b/data/geneva/test-dbtype-redis.sh
326new file mode 100755
327index 0000000..a1b522e
328--- /dev/null
329+++ b/data/geneva/test-dbtype-redis.sh
330@@ -0,0 +1,140 @@
331+#!/bin/bash -e
332+
333+# get the directory of this script
334+# snippet from https://stackoverflow.com/a/246128/10102404
335+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
336+
337+# load the utils
338+# shellcheck source=/dev/null
339+source "$SCRIPT_DIR/utils.sh"
340+
341+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
342+
343+snap_remove
344+
345+# install the snap to make sure it installs
346+if [ -n "$REVISION_TO_TEST" ]; then
347+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
348+else
349+ snap_install edgexfoundry "$DEFAULT_TEST_CHANNEL"
350+fi
351+
352+echo -n "finding jq... "
353+
354+set +e
355+if command -v edgexfoundry.jq > /dev/null; then
356+ JQ=$(command -v edgexfoundry.jq)
357+elif command -v jq > /dev/null; then
358+ JQ=$(command -v jq)
359+else
360+ echo "NOT FOUND"
361+ echo "install with snap install jq"
362+ exit 1
363+fi
364+
365+echo "found at $JQ"
366+
367+echo -n "finding toml2json... "
368+
369+set +e
370+if ! command -v toml2json > /dev/null; then
371+ echo "NOT FOUND"
372+ echo "install with \`snap install remarshal\`"
373+ exit 1
374+fi
375+
376+echo "found at $(command -v toml2json)"
377+
378+# wait for services to start up
379+sleep 120
380+
381+# check that the config files use mongo currently
382+for svc in core-data core-metadata export-client support-notifications support-scheduler; do
383+ # the type should be mongodb
384+ if [ "$(toml2json < "/var/snap/edgexfoundry/current/config/$svc/res/configuration.toml" | jq -r '.Databases.Primary.Type')" != "mongodb" ]; then
385+ echo "incorrect initial setting for $svc primary database type"
386+ exit 1
387+ fi
388+ # the port should be 27017
389+ if [ "$(toml2json < "/var/snap/edgexfoundry/current/config/$svc/res/configuration.toml" | jq -r '.Databases.Primary.Port')" != "27017" ]; then
390+ echo "incorrect initial setting for $svc primary database port"
391+ exit 1
392+ fi
393+done
394+
395+# ensure mongod is running
396+if [ -n "$(snap services edgexfoundry.mongod | grep edgexfoundry.mongod | grep inactive)" ]; then
397+ echo "mongod is not running initially"
398+ exit 1
399+fi
400+
401+# ensure mongod is enabled
402+if [ -z "$(snap services edgexfoundry.mongod | grep edgexfoundry.mongod | grep enabled)" ]; then
403+ echo "mongod is not enabled initially"
404+ exit 1
405+fi
406+
407+# ensure redis is not running
408+if [ -z "$(snap services edgexfoundry.redis | grep edgexfoundry.redis | grep inactive)" ]; then
409+ echo "redis is running initially"
410+ exit 1
411+fi
412+
413+# ensure redis is disabled
414+if [ -z "$(snap services edgexfoundry.redis | grep edgexfoundry.redis | grep disabled)" ]; then
415+ echo "redis is enabled intially"
416+ exit 1
417+fi
418+
419+# set the dbtype
420+snap set edgexfoundry dbtype=redis
421+
422+# wait for services to start/restart
423+sleep 15
424+
425+# ensure mongod isn't running
426+if [ -z "$(snap services edgexfoundry.mongod | grep edgexfoundry.mongod | grep inactive)" ]; then
427+ echo "mongod is still running after changing to redis"
428+ exit 1
429+fi
430+
431+# ensure mongod is disabled
432+if [ -z "$(snap services edgexfoundry.mongod | grep edgexfoundry.mongod | grep disabled)" ]; then
433+ echo "mongod is still enabled after changing to redis"
434+ exit 1
435+fi
436+
437+# ensure redis is now running
438+if [ -n "$(snap services edgexfoundry.redis | grep edgexfoundry.redis | grep inactive)" ]; then
439+ echo "redis is not running after changing to redis"
440+ exit 1
441+fi
442+
443+# ensure redis is enabled
444+if [ -z "$(snap services edgexfoundry.redis | grep edgexfoundry.redis | grep enabled)" ]; then
445+ echo "redis is not enabled after changing to redis"
446+ exit 1
447+fi
448+
449+# check that the config files now use redis currently
450+for svc in core-data core-metadata export-client support-notifications support-scheduler; do
451+ # the type should be redisdb
452+ if [ "$(toml2json < "/var/snap/edgexfoundry/current/config/$svc/res/configuration.toml" | jq -r '.Databases.Primary.Type')" != "redisdb" ]; then
453+ echo "incorrect changed setting for $svc primary database type"
454+ exit 1
455+ fi
456+ # the port should be 6379
457+ if [ "$(toml2json < "/var/snap/edgexfoundry/current/config/$svc/res/configuration.toml" | jq -r '.Databases.Primary.Port')" != "6379" ]; then
458+ echo "incorrect changed setting for $svc primary database port"
459+ exit 1
460+ fi
461+done
462+
463+# support-logging should now have file persistence
464+if [ "$(toml2json < "/var/snap/edgexfoundry/current/config/support-logging/res/configuration.toml" | jq -r '.Writable.Persistence')" != "file" ]; then
465+ echo "incorrect initial setting for support-logging persistence mechanism"
466+ exit 1
467+fi
468+
469+# remove the snap to run again
470+snap_remove
471diff --git a/data/geneva/test-device-virtual.sh b/data/geneva/test-device-virtual.sh
472new file mode 100755
473index 0000000..6251d8d
474--- /dev/null
475+++ b/data/geneva/test-device-virtual.sh
476@@ -0,0 +1,104 @@
477+#!/bin/bash -e
478+
479+# get the directory of this script
480+# snippet from https://stackoverflow.com/a/246128/10102404
481+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
482+
483+# load the utils
484+# shellcheck source=/dev/null
485+source "$SCRIPT_DIR/utils.sh"
486+
487+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
488+
489+snap_remove
490+
491+# install the snap to make sure it installs
492+if [ -n "$REVISION_TO_TEST" ]; then
493+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
494+else
495+ snap_install edgexfoundry "$DEFAULT_TEST_CHANNEL"
496+fi
497+
498+# wait for services to come online
499+# NOTE: this may have to be significantly increased on arm64 or low RAM platforms
500+# to accomodate time for everything to come online
501+sleep 120
502+
503+# start device-virtual
504+snap start edgexfoundry.device-virtual
505+
506+# wait 10 seconds - check to make sure it's still running
507+sleep 10
508+if [ -n "$(snap services edgexfoundry.device-virtual | grep edgexfoundry.device-virtual | grep inactive)" ]; then
509+ echo "failed to start device-virtual"
510+ exit 1
511+fi
512+
513+echo -n "finding jq... "
514+
515+set +e
516+if command -v edgexfoundry.jq > /dev/null; then
517+ JQ=$(command -v edgexfoundry.jq)
518+elif command -v jq > /dev/null; then
519+ JQ=$(command -v jq)
520+else
521+ echo "NOT FOUND"
522+ echo "install with \`snap install jq\`"
523+ exit 1
524+fi
525+
526+echo "found at $JQ"
527+
528+# a new try every other second, at max 30 tries is 1 minute for device-virtual
529+# to start
530+MAX_READING_TRIES=30
531+num_tries=0
532+
533+# check to see if we can find the device created by device-virtual
534+while true; do
535+ if ! (edgexfoundry.curl -s localhost:48081/api/v1/device | $JQ '.'); then
536+ # not json - something's wrong
537+ echo "invalid JSON response from core-metadata"
538+ exit 1
539+ elif [ "$(edgexfoundry.curl -s localhost:48081/api/v1/device | $JQ 'map(select(.name == "Random-Boolean-Device")) | length')" -lt 1 ]; then
540+ # increment number of tries
541+ num_tries=$((num_tries+1))
542+ if (( num_tries > MAX_READING_TRIES )); then
543+ echo "max tries attempting to get device-virtual readings"
544+ exit 1
545+ fi
546+ # no readings yet, keep waiting
547+ sleep 2
548+ else
549+ # got the device, break out
550+ break
551+ fi
552+done
553+
554+# reset the number of tries
555+num_tries=0
556+
557+# check to see if we can get a reading from the Random-Boolean-Device
558+while true; do
559+ if ! (edgexfoundry.curl -s localhost:48080/api/v1/reading/device/Random-Boolean-Device/10 | $JQ '.'); then
560+ # not json - something's wrong
561+ echo "invalid JSON response from core-data"
562+ exit 1
563+ elif [ "$(edgexfoundry.curl -s localhost:48080/api/v1/reading/device/Random-Boolean-Device/10 | $JQ 'length')" -le 1 ]; then
564+ # increment number of tries
565+ num_tries=$((num_tries+1))
566+ if (( num_tries > MAX_READING_TRIES )); then
567+ echo "max tries attempting to get device-virtual readings"
568+ exit 1
569+ fi
570+ # no readings yet, keep waiting
571+ sleep 2
572+ else
573+ # got at least one reading, break out
574+ break
575+ fi
576+done
577+set -e
578+
579+# remove the snap to run the next test
580+snap_remove
581diff --git a/data/geneva/test-install-config-paths.sh b/data/geneva/test-install-config-paths.sh
582new file mode 100755
583index 0000000..dc5604f
584--- /dev/null
585+++ b/data/geneva/test-install-config-paths.sh
586@@ -0,0 +1,49 @@
587+#!/bin/bash -e
588+
589+# get the directory of this script
590+# snippet from https://stackoverflow.com/a/246128/10102404
591+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
592+
593+# load the utils
594+# shellcheck source=/dev/null
595+source "$SCRIPT_DIR/utils.sh"
596+
597+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
598+
599+snap_remove
600+
601+# now install the snap version we are testing and check again
602+if [ -n "$REVISION_TO_TEST" ]; then
603+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
604+else
605+ snap_install edgexfoundry "$DEFAULT_TEST_CHANNEL"
606+fi
607+
608+# get the revision number for this channel
609+SNAP_REVISION=$(snap run --shell edgexfoundry.consul -c "echo \$SNAP_REVISION")
610+
611+# wait for services to come online
612+# NOTE: this may have to be significantly increased on arm64 or low RAM platforms
613+# to accomodate time for everything to come online
614+sleep 120
615+
616+echo "checking for files with snap revision $SNAP_REVISION"
617+
618+# check that all files in $SNAP_DATA don't reference the previous revision
619+# except for binary files, cassandra log files, and an errant comment I
620+# put in the vault hcl file which the install hook from previous revisions
621+# also ends up putting the path including the old revision number inside
622+cd /var/snap/edgexfoundry/current
623+set +e
624+notUpgradedFiles=$(grep -R "edgexfoundry/$SNAP_REVISION" | \
625+ grep -v "Binary file" | \
626+ grep -v "postmaster" | \
627+ grep -v "and the location of the files uses reference")
628+if [ -n "$notUpgradedFiles" ]; then
629+ echo "files not upgraded to use \"current\" symlink in config files:"
630+ echo "$notUpgradedFiles"
631+ exit 1
632+fi
633+set -e
634+
635+snap_remove
636diff --git a/data/geneva/test-install.sh b/data/geneva/test-install.sh
637new file mode 100755
638index 0000000..8b7fbe4
639--- /dev/null
640+++ b/data/geneva/test-install.sh
641@@ -0,0 +1,23 @@
642+#!/bin/bash -e
643+
644+# get the directory of this script
645+# snippet from https://stackoverflow.com/a/246128/10102404
646+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
647+
648+# load the utils
649+# shellcheck source=/dev/null
650+source "$SCRIPT_DIR/utils.sh"
651+
652+snap_remove
653+
654+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
655+
656+# install the snap to make sure it installs
657+if [ -n "$REVISION_TO_TEST" ]; then
658+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
659+else
660+ snap_install edgexfoundry "$DEFAULT_TEST_CHANNEL"
661+fi
662+
663+# remove the snap to run again
664+snap_remove
665diff --git a/data/geneva/test-refresh-config-paths.sh b/data/geneva/test-refresh-config-paths.sh
666new file mode 100755
667index 0000000..55d1202
668--- /dev/null
669+++ b/data/geneva/test-refresh-config-paths.sh
670@@ -0,0 +1,87 @@
671+#!/bin/bash -e
672+
673+# get the directory of this script
674+# snippet from https://stackoverflow.com/a/246128/10102404
675+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
676+
677+# load the utils
678+# shellcheck source=/dev/null
679+source "$SCRIPT_DIR/utils.sh"
680+
681+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
682+
683+snap_remove
684+
685+echo "skipping test until snap with epoch 1 is released to edge"
686+exit 0
687+
688+for channel in edge; do
689+ # first make sure that the snap installs correctly from the channel
690+ case "$channel" in
691+ delhi)
692+ echo "installing delhi channel snap"
693+ if [ -n "$EDGEX_EDINBURGH_SNAP_FILE" ]; then
694+ snap_install "$EDGEX_EDINBURGH_SNAP_FILE"
695+ else
696+ snap_install edgexfoundry edinburgh
697+ fi
698+ ;;
699+ stable)
700+ echo "installing stable channel snap"
701+ if [ -n "$EDGEX_STABLE_SNAP_FILE" ]; then
702+ snap_install "$EDGEX_STABLE_SNAP_FILE"
703+ else
704+ snap_install edgexfoundry stable
705+ fi
706+ ;;
707+ *)
708+ echo "installing $channel channel snap"
709+ snap_install edgexfoundry "$channel"
710+ ;;
711+ esac
712+
713+ # get the revision number for this channel
714+ SNAP_REVISION=$(snap run --shell edgexfoundry.consul -c "echo \$SNAP_REVISION")
715+
716+ # wait for services to come online
717+ # NOTE: this may have to be significantly increased on arm64 or low RAM platforms
718+ # to accomodate time for everything to come online
719+ sleep 120
720+
721+ # now install the snap version we are testing and check again
722+ if [ -n "$REVISION_TO_TEST" ]; then
723+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
724+ else
725+ snap_refresh edgexfoundry "$DEFAULT_TEST_CHANNEL"
726+ fi
727+
728+ # wait for services to come online
729+ # NOTE: this may have to be significantly increased on arm64 or low RAM platforms
730+ # to accomodate time for everything to come online
731+ sleep 120
732+
733+ echo "checking for files with previous snap revision $SNAP_REVISION"
734+
735+ # check that all files in $SNAP_DATA don't reference the previous revision
736+ # except for binary files, cassandra log files, and an errant comment I
737+ # put in the vault hcl file which the install hook from previous revisions
738+ # also ends up putting the path including the old revision number inside
739+ pushd /var/snap/edgexfoundry/current > /dev/null
740+ set +e
741+ notUpgradedFiles=$(grep -R "edgexfoundry/$SNAP_REVISION" | \
742+ grep -v "Binary file" | \
743+ grep -v "cassandra/logs" | \
744+ grep -v "and the location of the files uses reference")
745+ popd > /dev/null
746+ if [ -n "$notUpgradedFiles" ]; then
747+ echo "files not upgraded to use \"current\" symlink in config files:"
748+ echo "$notUpgradedFiles"
749+ exit 1
750+ fi
751+ set -e
752+
753+ echo "removing $channel snap"
754+
755+ # remove the snap to run the next channel upgrade
756+ snap_remove
757+done
758diff --git a/data/geneva/test-refresh-services.sh b/data/geneva/test-refresh-services.sh
759new file mode 100755
760index 0000000..5b598ca
761--- /dev/null
762+++ b/data/geneva/test-refresh-services.sh
763@@ -0,0 +1,61 @@
764+#!/bin/bash -e
765+
766+# get the directory of this script
767+# snippet from https://stackoverflow.com/a/246128/10102404
768+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
769+
770+# load the utils
771+# shellcheck source=/dev/null
772+source "$SCRIPT_DIR/utils.sh"
773+
774+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
775+
776+snap_remove
777+
778+echo "skipping test until snap with epoch 1 is released to edge"
779+exit 0
780+
781+for channel in edge; do
782+ # first make sure that the snap installs correctly from the channel
783+ # use locally cached version of stable and delhi
784+ case "$channel" in
785+ delhi)
786+ if [ -n "$EDGEX_EDINBURGH_SNAP_FILE" ]; then
787+ snap_install "$EDGEX_EDINBURGH_SNAP_FILE"
788+ else
789+ snap_install edgexfoundry edinburgh
790+ fi
791+ ;;
792+ stable)
793+ if [ -n "$EDGEX_STABLE_SNAP_FILE" ]; then
794+ snap_install "$EDGEX_STABLE_SNAP_FILE"
795+ else
796+ snap_install edgexfoundry stable
797+ fi
798+ ;;
799+ *)
800+ snap_install edgexfoundry "$channel"
801+ ;;
802+ esac
803+ # wait for services to come online
804+ # NOTE: this may have to be significantly increased on arm64 or low RAM platforms
805+ # to accomodate time for everything to come online
806+ sleep 120
807+ snap_check_geneva_svcs
808+
809+ # now install the snap version we are testing and check again
810+ if [ -n "$REVISION_TO_TEST" ]; then
811+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
812+ else
813+ snap_refresh edgexfoundry "$DEFAULT_TEST_CHANNEL"
814+ fi
815+ # wait for services to come online
816+ # NOTE: this may have to be significantly increased on arm64 or low RAM platforms
817+ # to accomodate time for everything to come online
818+ sleep 120
819+
820+ snap_check_genava_svcs --notfatal
821+
822+ # remove the snap to run the next channel upgrade
823+ snap_remove
824+done
825diff --git a/data/geneva/test-security-services-proxy-certs.sh b/data/geneva/test-security-services-proxy-certs.sh
826new file mode 100755
827index 0000000..bdc3bec
828--- /dev/null
829+++ b/data/geneva/test-security-services-proxy-certs.sh
830@@ -0,0 +1,46 @@
831+#!/bin/bash -e
832+
833+# get the directory of this script
834+# snippet from https://stackoverflow.com/a/246128/10102404
835+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
836+
837+# load the utils
838+# shellcheck source=/dev/null
839+source "$SCRIPT_DIR/utils.sh"
840+
841+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
842+
843+snap_remove
844+
845+# install the snap to make sure it installs
846+if [ -n "$REVISION_TO_TEST" ]; then
847+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
848+else
849+ snap_install edgexfoundry "$DEFAULT_TEST_CHANNEL"
850+fi
851+
852+# wait for services to come online
853+# NOTE: this may have to be significantly increased on arm64 or low RAM platforms
854+# to accomodate time for everything to come online
855+sleep 240
856+
857+# copy the root certificate to confirm that can be used to authenticate the
858+# kong server
859+cp /var/snap/edgexfoundry/current/pki/EdgeXFoundryCA/EdgeXFoundryCA.pem /var/snap/edgexfoundry/current/EdgeXFoundryCA.pem
860+
861+# make the CA world-readable
862+chmod +r /var/snap/edgexfoundry/current/EdgeXFoundryCA.pem
863+
864+# use curl to talk to the kong admin endpoint with the cert
865+edgexfoundry.curl --cacert /var/snap/edgexfoundry/current/EdgeXFoundryCA.pem https://localhost:8443/command > /dev/null
866+
867+# restart all of EdgeX (including the security-services) and make sure the
868+# same certificate still works
869+snap disable edgexfoundry > /dev/null
870+snap enable edgexfoundry > /dev/null
871+
872+sleep 240
873+edgexfoundry.curl --cacert /var/snap/edgexfoundry/current/EdgeXFoundryCA.pem https://localhost:8443/command > /dev/null
874+
875+# remove the snap to run the next test
876+snap_remove
877diff --git a/data/geneva/test-self-refresh-services.sh b/data/geneva/test-self-refresh-services.sh
878new file mode 100755
879index 0000000..fb628ab
880--- /dev/null
881+++ b/data/geneva/test-self-refresh-services.sh
882@@ -0,0 +1,56 @@
883+#!/bin/bash -e
884+
885+# get the directory of this script
886+# snippet from https://stackoverflow.com/a/246128/10102404
887+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
888+
889+# load the utils
890+# shellcheck source=/dev/null
891+source "$SCRIPT_DIR/utils.sh"
892+
893+# remove the snap if it's already installed
894+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
895+
896+snap_remove
897+
898+# install the snap version we are testing
899+if [ -n "$REVISION_TO_TEST" ]; then
900+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
901+else
902+ snap_install edgexfoundry "$DEFAULT_TEST_CHANNEL"
903+fi
904+
905+# wait for services to come online
906+# NOTE: this may have to be significantly increased on arm64 or low RAM platforms
907+# to accomodate time for everything to come online
908+sleep 120
909+
910+# now install the same snap version we are testing to test the pre-refresh
911+# and post-refresh logic in this revision
912+if [ -n "$REVISION_TO_TEST" ]; then
913+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
914+else
915+ # if we aren't running locally, then we need to download the revision and
916+ # install it locally as if it was a different revision
917+ snap_download_output=$(snap download edgexfoundry --channel="$DEFAULT_TEST_CHANNEL")
918+ THIS_REVISION_LOCALLY="$(pwd)/$(echo "$snap_download_output" | grep -Po 'edgexfoundry_[0-9]+\.snap')"
919+ snap_install "$THIS_REVISION_LOCALLY" "" "--devmode"
920+fi
921+
922+# wait for services to come online
923+# NOTE: this may have to be significantly increased on arm64 or low RAM platforms
924+# to accomodate time for everything to come online
925+sleep 120
926+
927+# ignore failures for now due to https://bugs.launchpad.net/snapd/+bug/1818306
928+snap_check_geneva_svcs --notfatal
929+
930+# ensure the release config item is set to fuji
931+snapRelease=$(snap get edgexfoundry release)
932+if [ "$snapRelease" != "geneva" ]; then
933+ echo "missing or invalid config item for snap release: \"$snapRelease\""
934+ snap_remove
935+ exit 1
936+fi
937+
938+snap_remove
939diff --git a/data/geneva/test-services-alive.sh b/data/geneva/test-services-alive.sh
940new file mode 100755
941index 0000000..b2a7959
942--- /dev/null
943+++ b/data/geneva/test-services-alive.sh
944@@ -0,0 +1,32 @@
945+#!/bin/bash -e
946+
947+# get the directory of this script
948+# snippet from https://stackoverflow.com/a/246128/10102404
949+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
950+
951+# load the utils
952+# shellcheck source=/dev/null
953+source "$SCRIPT_DIR/utils.sh"
954+
955+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
956+
957+snap_remove
958+
959+# install the snap to make sure it installs
960+if [ -n "$REVISION_TO_TEST" ]; then
961+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
962+else
963+ snap_install edgexfoundry "$DEFAULT_TEST_CHANNEL"
964+fi
965+
966+# wait for services to come online
967+# NOTE: this may have to be significantly increased on arm64 or low RAM platforms
968+# to accomodate time for everything to come online
969+sleep 120
970+
971+# check services
972+# ignore failures for now due to https://bugs.launchpad.net/snapd/+bug/1818306
973+snap_check_geneva_svcs
974+
975+# remove the snap to run the next test
976+snap_remove
977diff --git a/data/geneva/test-sys-mgmt-agent.sh b/data/geneva/test-sys-mgmt-agent.sh
978new file mode 100755
979index 0000000..a852663
980--- /dev/null
981+++ b/data/geneva/test-sys-mgmt-agent.sh
982@@ -0,0 +1,84 @@
983+#!/bin/bash -e
984+
985+# get the directory of this script
986+# snippet from https://stackoverflow.com/a/246128/10102404
987+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
988+
989+# load the utils
990+# shellcheck source=/dev/null
991+source "$SCRIPT_DIR/utils.sh"
992+
993+DEFAULT_TEST_CHANNEL=${DEFAULT_TEST_CHANNEL:-beta}
994+
995+snap_remove
996+
997+# now install the snap version we are testing and check again
998+if [ -n "$REVISION_TO_TEST" ]; then
999+ snap_install "$REVISION_TO_TEST" "$REVISION_TO_TEST_CHANNEL" "$REVISION_TO_TEST_CONFINEMENT"
1000+else
1001+ snap_install edgexfoundry "$DEFAULT_TEST_CHANNEL"
1002+fi
1003+
1004+# wait for services to come online
1005+# NOTE: this may have to be significantly increased on arm64 or low RAM platforms
1006+# to accomodate time for everything to come online
1007+sleep 120
1008+
1009+# make sure that core-data is running
1010+if [ -n "$(snap services edgexfoundry.core-data | grep edgexfoundry.core-data | grep inactive)" ]; then
1011+ echo "core-data is not running"
1012+ snap_remove
1013+ exit 1
1014+fi
1015+
1016+# issue a stop command to the SMA for core-data
1017+edgexfoundry.curl \
1018+ --fail \
1019+ --header "Content-Type: application/json" \
1020+ --request POST \
1021+ --data '{"action":"stop","services":["edgex-core-data"]}' \
1022+ localhost:48090/api/v1/operation
1023+
1024+# check that core-data is no longer running
1025+if [ -z "$(snap services edgexfoundry.core-data | grep edgexfoundry.core-data | grep inactive)" ]; then
1026+ echo "SMA failed to stop core-data"
1027+ snap_remove
1028+ exit 1
1029+fi
1030+
1031+# TODO: enable these other tests for Edinburgh where they will actually work
1032+# for delhi, only stopping services works with the SMA
1033+
1034+# issue a start command to the SMA for core-data
1035+edgexfoundry.curl \
1036+ --fail \
1037+ --header "Content-Type: application/json" \
1038+ --request POST \
1039+ --data '{"action":"start","services":["edgex-core-data"]}' \
1040+ localhost:48090/api/v1/operation
1041+
1042+# check that core-data is now running
1043+if [ -n "$(snap services edgexfoundry.core-data | grep edgexfoundry.core-data | grep inactive)" ]; then
1044+ echo "SMA failed to stop core-data"
1045+ snap_remove
1046+ exit 1
1047+fi
1048+
1049+# issue a bogus start command to the SMA to check that it returns an error message
1050+set +e
1051+fail_response = edgexfoundry.curl \
1052+ --fail \
1053+ --header "Content-Type: application/json" \
1054+ --request POST \
1055+ --data '{"action":"start","services":["NOT-A-REAL-SERVICE"]}' \
1056+ localhost:48090/api/v1/operation | edgexfoundry.jq '.[0].Success'
1057+
1058+if [ "$fail_response" == "false" ]; then
1059+ echo
1060+ echo "SMA erronously reports starting a non-existent service"
1061+ snap_remove
1062+ exit 1
1063+fi
1064+set -e
1065+
1066+snap_remove
1067diff --git a/data/geneva/utils.sh b/data/geneva/utils.sh
1068new file mode 100755
1069index 0000000..3eba383
1070--- /dev/null
1071+++ b/data/geneva/utils.sh
1072@@ -0,0 +1,296 @@
1073+#!/bin/bash -e
1074+
1075+if [ "$(id -u)" != "0" ]; then
1076+ echo "script must be run as root"
1077+ exit 1
1078+fi
1079+
1080+snap_install()
1081+{
1082+ local the_snap=$1
1083+ local the_channel=$2
1084+ local confinement=$3
1085+
1086+ if [ "$the_snap" = "edgexfoundry" ]; then
1087+ if [ -n "$confinement" ]; then
1088+ snap install "$the_snap" --channel="$the_channel" "$confinement"
1089+ else
1090+ snap install "$the_snap" --channel="$the_channel"
1091+ fi
1092+ else
1093+ if [ -n "$confinement" ]; then
1094+ snap install "$the_snap" "$confinement"
1095+ else
1096+ snap install "$the_snap"
1097+ fi
1098+ fi
1099+}
1100+
1101+snap_refresh()
1102+{
1103+ local the_snap=$1
1104+ local the_channel=$2
1105+ local confinement=$3
1106+
1107+ if [ "$the_snap" = "edgexfoundry" ]; then
1108+ if [ -n "$confinement" ]; then
1109+ snap refresh "$the_snap" --channel="$the_channel" "$confinement"
1110+ else
1111+ snap refresh "$the_snap" --channel="$the_channel"
1112+ fi
1113+ else
1114+ # for refreshing a file snap we need to use install
1115+ # but snapd still treats it like a refresh
1116+ if [ -n "$confinement" ]; then
1117+ snap install "$the_snap" "$confinement"
1118+ else
1119+ snap install "$the_snap"
1120+ fi
1121+ fi
1122+}
1123+
1124+snap_check_delhi_svcs()
1125+{
1126+ if [ "$1" = "--notfatal" ]; then
1127+ FATAL=0
1128+ else
1129+ FATAL=1
1130+ fi
1131+ # group services by status
1132+
1133+ # enabled services
1134+ # all the core-* services, security-services, consul, and all the mongo* services
1135+ for svc in core-command core-data core-metadata security-services mongod mongo-worker core-config-seed consul; do
1136+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $2}')"
1137+ if [ "enabled" != "$svcStatus" ]; then
1138+ echo "service $svc has status \"$svcStatus\" but should be enabled"
1139+ if [ "$FATAL" = "1" ]; then
1140+ exit 1
1141+ fi
1142+ fi
1143+ done
1144+
1145+ # active services
1146+ # same as enabled, but without core-config-seed and without mongo-worker as
1147+ # those are both oneshot daemons
1148+ for svc in core-command core-data core-metadata security-services mongod consul ; do
1149+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $3}')"
1150+ if [ "active" != "$svcStatus" ]; then
1151+ echo "service $svc has status \"$svcStatus\" but should be active"
1152+ if [ "$FATAL" = "1" ]; then
1153+ exit 1
1154+ fi
1155+ fi
1156+ done
1157+
1158+ # disabled services
1159+ for svc in export-distro export-client support-notifications support-scheduler support-rulesengine support-logging device-virtual device-mqtt device-modbus device-random; do
1160+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $2}')"
1161+ if [ "disabled" != "$svcStatus" ]; then
1162+ echo "service $svc has status \"$svcStatus\" but should be disabled"
1163+ if [ "$FATAL" = "1" ]; then
1164+ exit 1
1165+ fi
1166+ fi
1167+ done
1168+
1169+ # inactive services
1170+ # all the disabled services + core-config-seed + mongo-worker
1171+ for svc in export-distro export-client support-notifications support-scheduler support-rulesengine support-logging device-virtual device-modbus device-mqtt device-random core-config-seed; do
1172+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $3}')"
1173+ if [ "inactive" != "$svcStatus" ]; then
1174+ echo "service $svc has status \"$svcStatus\" but should be inactive"
1175+ if [ "$FATAL" = "1" ]; then
1176+ exit 1
1177+ fi
1178+ fi
1179+ done
1180+}
1181+
1182+snap_check_edinburgh_svcs()
1183+{
1184+ if [ "$1" = "--notfatal" ]; then
1185+ FATAL=0
1186+ else
1187+ FATAL=1
1188+ fi
1189+ # group services by status
1190+
1191+ # enabled services
1192+ # all the core-* services, security-services, consul, and all the mongo* services
1193+ for svc in cassandra consul core-command core-config-seed core-data core-metadata edgexproxy kong-daemon mongo-worker mongod pkisetup sys-mgmt-agent vault vault-worker; do
1194+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $2}')"
1195+ if [ "enabled" != "$svcStatus" ]; then
1196+ echo "service $svc has status \"$svcStatus\" but should be enabled"
1197+ if [ "$FATAL" = "1" ]; then
1198+ exit 1
1199+ fi
1200+ fi
1201+ done
1202+
1203+ # active services
1204+ # same as enabled, but without core-config-seed, mongo-worker, edgexproxy, pkisetup or vault-worker as
1205+ # those are all oneshot daemons
1206+ for svc in cassandra consul core-command core-data core-metadata kong-daemon mongod sys-mgmt-agent vault; do
1207+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $3}')"
1208+ if [ "active" != "$svcStatus" ]; then
1209+ echo "service $svc has status \"$svcStatus\" but should be active"
1210+ if [ "$FATAL" = "1" ]; then
1211+ exit 1
1212+ fi
1213+ fi
1214+ done
1215+
1216+ # disabled services
1217+ for svc in device-random export-client export-distro support-logging support-notifications support-rulesengine support-scheduler; do
1218+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $2}')"
1219+ if [ "disabled" != "$svcStatus" ]; then
1220+ echo "service $svc has status \"$svcStatus\" but should be disabled"
1221+ if [ "$FATAL" = "1" ]; then
1222+ exit 1
1223+ fi
1224+ fi
1225+ done
1226+
1227+ # inactive services
1228+ # all the disabled services + the oneshot daemons
1229+ for svc in core-config-seed device-random edgexproxy export-client export-distro mongo-worker pkisetup support-logging support-notifications support-rulesengine support-scheduler vault-worker; do
1230+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $3}')"
1231+ if [ "inactive" != "$svcStatus" ]; then
1232+ echo "service $svc has status \"$svcStatus\" but should be inactive"
1233+ if [ "$FATAL" = "1" ]; then
1234+ exit 1
1235+ fi
1236+ fi
1237+ done
1238+}
1239+
1240+snap_check_fuji_svcs()
1241+{
1242+ if [ "$1" = "--notfatal" ]; then
1243+ FATAL=0
1244+ else
1245+ FATAL=1
1246+ fi
1247+ # group services by status
1248+
1249+ # enabled services
1250+ # all the core-* services, security-services, consul, and all the *mongo* services
1251+ for svc in consul core-command core-config-seed core-data core-metadata edgex-mongo kong-daemon mongod postgres security-proxy-setup security-secrets-setup security-secretstore-setup sys-mgmt-agent vault; do
1252+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $2}')"
1253+ if [ "enabled" != "$svcStatus" ]; then
1254+ echo "service $svc has status \"$svcStatus\" but should be enabled"
1255+ if [ "$FATAL" = "1" ]; then
1256+ exit 1
1257+ fi
1258+ fi
1259+ done
1260+
1261+ # active services
1262+ # same as enabled, but without core-config-seed, edgex-mongo, security-*-setup as those are all oneshot daemons
1263+ for svc in consul core-command core-data core-metadata kong-daemon redis postgres sys-mgmt-agent vault; do
1264+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $3}')"
1265+ if [ "active" != "$svcStatus" ]; then
1266+ echo "service $svc has status \"$svcStatus\" but should be active"
1267+ if [ "$FATAL" = "1" ]; then
1268+ exit 1
1269+ fi
1270+ fi
1271+ done
1272+
1273+ # disabled services
1274+ for svc in app-service-configurable device-virtual export-client export-distro support-logging mongod support-notifications support-rulesengine support-scheduler; do
1275+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $2}')"
1276+ if [ "disabled" != "$svcStatus" ]; then
1277+ echo "service $svc has status \"$svcStatus\" but should be disabled"
1278+ if [ "$FATAL" = "1" ]; then
1279+ exit 1
1280+ fi
1281+ fi
1282+ done
1283+
1284+ # inactive services
1285+ # all the disabled services + the oneshot daemons
1286+ for svc in app-service-configurable device-virtual edgex-mongo export-client export-distro mongod security-proxy-setup security-secrets-setup security-secretstore-setup support-logging support-notifications support-rulesengine support-scheduler; do
1287+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $3}')"
1288+ if [ "inactive" != "$svcStatus" ]; then
1289+ echo "service $svc has status \"$svcStatus\" but should be inactive"
1290+ if [ "$FATAL" = "1" ]; then
1291+ exit 1
1292+ fi
1293+ fi
1294+ done
1295+}
1296+
1297+snap_check_geneva_svcs()
1298+{
1299+ if [ "$1" = "--notfatal" ]; then
1300+ FATAL=0
1301+ else
1302+ FATAL=1
1303+ fi
1304+ # group services by status
1305+
1306+ # enabled services
1307+ # all the core-* services, security-services, consul, and redis
1308+ for svc in consul core-command core-data core-metadata kong-daemon redis postgres security-proxy-setup security-secrets-setup security-secretstore-setup sys-mgmt-agent vault; do
1309+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $2}')"
1310+ if [ "enabled" != "$svcStatus" ]; then
1311+ echo "service $svc has status \"$svcStatus\" but should be enabled"
1312+ if [ "$FATAL" = "1" ]; then
1313+ exit 1
1314+ fi
1315+ fi
1316+ done
1317+
1318+ # active services
1319+ # same as enabled, but without security-*-setup as those are all oneshot daemons
1320+ for svc in consul core-command core-data core-metadata kong-daemon redis postgres sys-mgmt-agent vault; do
1321+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $3}')"
1322+ if [ "active" != "$svcStatus" ]; then
1323+ echo "service $svc has status \"$svcStatus\" but should be active"
1324+ if [ "$FATAL" = "1" ]; then
1325+ exit 1
1326+ fi
1327+ fi
1328+ done
1329+
1330+ # disabled services
1331+ for svc in app-service-configurable device-virtual edgex-mongo support-logging mongod support-notifications support-rulesengine support-scheduler; do
1332+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $2}')"
1333+ if [ "disabled" != "$svcStatus" ]; then
1334+ echo "service $svc has status \"$svcStatus\" but should be disabled"
1335+ if [ "$FATAL" = "1" ]; then
1336+ exit 1
1337+ fi
1338+ fi
1339+ done
1340+
1341+ # inactive services
1342+ # all the disabled services + the oneshot daemons
1343+ for svc in app-service-configurable device-virtual edgex-mongo mongod security-proxy-setup security-secrets-setup security-secretstore-setup support-logging support-notifications support-rulesengine support-scheduler; do
1344+ svcStatus="$(snap services edgexfoundry.$svc | grep $svc | awk '{print $3}')"
1345+ if [ "inactive" != "$svcStatus" ]; then
1346+ echo "service $svc has status \"$svcStatus\" but should be inactive"
1347+ if [ "$FATAL" = "1" ]; then
1348+ exit 1
1349+ fi
1350+ fi
1351+ done
1352+}
1353+
1354+get_snap_svc_status()
1355+{
1356+ case "$1" in
1357+ "status")
1358+ svcStatus="$(snap services edgexfoundry.$1 | grep $1 | awk '{print $3}')"
1359+ ;;
1360+ "")
1361+ ;;
1362+ esac
1363+}
1364+
1365+snap_remove()
1366+{
1367+ snap remove edgexfoundry || true
1368+}
1369diff --git a/data/hanoi/placeholder.txt b/data/hanoi/placeholder.txt
1370new file mode 100644
1371index 0000000..e69de29
1372--- /dev/null
1373+++ b/data/hanoi/placeholder.txt
1374diff --git a/data/ireland/placeholder.txt b/data/ireland/placeholder.txt
1375new file mode 100644
1376index 0000000..e69de29
1377--- /dev/null
1378+++ b/data/ireland/placeholder.txt
1379diff --git a/data/jakarta/placeholder.txt b/data/jakarta/placeholder.txt
1380new file mode 100644
1381index 0000000..e69de29
1382--- /dev/null
1383+++ b/data/jakarta/placeholder.txt
1384diff --git a/units/jobs.pxu b/units/fuji.pxu
1385similarity index 66%
1386rename from units/jobs.pxu
1387rename to units/fuji.pxu
1388index a435bed..88695e7 100644
1389--- a/units/jobs.pxu
1390+++ b/units/fuji.pxu
1391@@ -1,62 +1,62 @@
1392-id: edgex/install
1393+id: edgex/fuji/install
1394 _summary: Test installation of EdgeX snap
1395-command: test-install.sh
1396+command: $PLAINBOX_PROVIDER_DATA/fuji/test-install.sh
1397 user: root
1398 category_id: edgex
1399 flags: simple
1400
1401-id: edgex/security-services-proxy-certs
1402+id: edgex/fuji/security-services-proxy-certs
1403 _summary: Test security services proxy certs work properly
1404-command: test-security-services-proxy-certs.sh
1405+command: $PLAINBOX_PROVIDER_DATA/fuji/test-security-services-proxy-certs.sh
1406 user: root
1407 category_id: edgex
1408 flags: simple
1409
1410-id: edgex/services-alive
1411+id: edgex/fuji/services-alive
1412 _summary: Test that all services can be started properly
1413-command: test-services-alive.sh
1414+command: $PLAINBOX_PROVIDER_DATA/fuji/test-services-alive.sh
1415 user: root
1416 category_id: edgex
1417 flags: simple
1418
1419-id: edgex/device-random
1420+id: edgex/fuji/device-random
1421 _summary: Test that device-random works with core-data and core-metadata
1422-command: test-device-random.sh
1423+command: $PLAINBOX_PROVIDER_DATA/fuji/test-device-random.sh
1424 user: root
1425 category_id: edgex
1426 flags: simple
1427
1428-id: edgex/install-config-paths
1429+id: edgex/fuji/install-config-paths
1430 _summary: Test that installing uses "current" based filepaths in config files
1431-command: test-install-config-paths.sh
1432+command: $PLAINBOX_PROVIDER_DATA/fuji/test-install-config-paths.sh
1433 user: root
1434 category_id: edgex
1435 flags: simple
1436
1437-id: edgex/refresh-config-paths
1438+id: edgex/fuji/refresh-config-paths
1439 _summary: Test that refreshing uses "current" based filepaths in config files
1440-command: test-refresh-config-paths.sh
1441+command: $PLAINBOX_PROVIDER_DATA/fuji/test-refresh-config-paths.sh
1442 user: root
1443 category_id: edgex
1444 flags: simple
1445
1446-id: edgex/refresh-services
1447+id: edgex/fuji/refresh-services
1448 _summary: Test that services start after refreshing
1449-command: test-refresh-services.sh
1450+command: $PLAINBOX_PROVIDER_DATA/fuji/test-refresh-services.sh
1451 user: root
1452 category_id: edgex
1453 flags: simple
1454
1455-id: edgex/self-refresh-services
1456+id: edgex/fuji/self-refresh-services
1457 _summary: Test that services start after refreshing to this revision from self
1458-command: test-self-refresh-services.sh
1459+command: $PLAINBOX_PROVIDER_DATA/fuji/test-self-refresh-services.sh
1460 user: root
1461 category_id: edgex
1462 flags: simple
1463
1464-id: edgex/sys-mgmt-agent
1465+id: edgex/fuji/sys-mgmt-agent
1466 _summary: Test that the system management agent works with the snap
1467-command: test-sys-mgmt-agent.sh
1468+command: $PLAINBOX_PROVIDER_DATA/fuji/test-sys-mgmt-agent.sh
1469 user: root
1470 category_id: edgex
1471 flags: simple
1472diff --git a/units/geneva.pxu b/units/geneva.pxu
1473new file mode 100644
1474index 0000000..f08f90c
1475--- /dev/null
1476+++ b/units/geneva.pxu
1477@@ -0,0 +1,55 @@
1478+id: edgex/geneva/install
1479+_summary: Test installation of EdgeX snap
1480+command: $PLAINBOX_PROVIDER_DATA/geneva/test-install.sh
1481+user: root
1482+category_id: edgex
1483+flags: simple
1484+
1485+id: edgex/geneva/security-services-proxy-certs
1486+_summary: Test security services proxy certs work properly
1487+command: $PLAINBOX_PROVIDER_DATA/geneva/test-security-services-proxy-certs.sh
1488+user: root
1489+category_id: edgex
1490+flags: simple
1491+
1492+id: edgex/geneva/services-alive
1493+_summary: Test that all services can be started properly
1494+command: $PLAINBOX_PROVIDER_DATA/geneva/test-services-alive.sh
1495+user: root
1496+category_id: edgex
1497+flags: simple
1498+
1499+id: edgex/geneva/install-config-paths
1500+_summary: Test that installing uses "current" based filepaths in config files
1501+command: $PLAINBOX_PROVIDER_DATA/geneva/test-install-config-paths.sh
1502+user: root
1503+category_id: edgex
1504+flags: simple
1505+
1506+id: edgex/geneva/refresh-config-paths
1507+_summary: Test that refreshing uses "current" based filepaths in config files
1508+command: $PLAINBOX_PROVIDER_DATA/geneva/test-refresh-config-paths.sh
1509+user: root
1510+category_id: edgex
1511+flags: simple
1512+
1513+id: edgex/geneva/refresh-services
1514+_summary: Test that services start after refreshing
1515+command: $PLAINBOX_PROVIDER_DATA/geneva/test-refresh-services.sh
1516+user: root
1517+category_id: edgex
1518+flags: simple
1519+
1520+id: edgex/geneva/self-refresh-services
1521+_summary: Test that services start after refreshing to this revision from self
1522+command: $PLAINBOX_PROVIDER_DATA/geneva/test-self-refresh-services.sh
1523+user: root
1524+category_id: edgex
1525+flags: simple
1526+
1527+id: edgex/geneva/sys-mgmt-agent
1528+_summary: Test that the system management agent works with the snap
1529+command: $PLAINBOX_PROVIDER_DATA/geneva/test-sys-mgmt-agent.sh
1530+user: root
1531+category_id: edgex
1532+flags: simple
1533diff --git a/units/test-plan.pxu b/units/test-plan.pxu
1534index f5d96b0..d9524a3 100644
1535--- a/units/test-plan.pxu
1536+++ b/units/test-plan.pxu
1537@@ -1,6 +1,13 @@
1538-id: edgex-tp
1539+id: edgex-fuji-tp
1540 unit: test plan
1541-_name: EdgeX
1542-_description: EdgeX tests
1543+_name: EdgeX Fuji
1544+_description: EdgeX Fuji tests
1545 include:
1546- edgex/.*
1547+ edgex/fuji/.*
1548+
1549+id: edgex-geneva-tp
1550+unit: test plan
1551+_name: EdgeX Geneva
1552+_description: EdgeX Geneva tests
1553+include:
1554+ edgex/geneva/.*

Subscribers

People subscribed via source and target branches