-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.sh
executable file
·47 lines (33 loc) · 1.22 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash -ex
# remove any previous snaps
sudo snap remove edgexfoundry \
edgex-device-mqtt \
mosquitto \
edgex-influx-proxy \
influxdb-ijohnson
if ! command -v jq > /dev/null; then
sudo snap install jq
fi
sudo snap install mosquitto influxdb-ijohnson
# TODO: paramaterize the edgex channel to test with
TRACK=latest
sudo snap install edgexfoundry --channel="$TRACK/stable"
# install the version of the edgex-influx-proxy version under test
sudo snap install --dangerous "$@"
# don't use track for device service
sudo snap install edgex-device-mqtt
# create the influxdb database
influxdb-ijohnson.influx -execute "CREATE DATABASE edgex"
# wait for things to startup
sleep 10
# start device-mqtt
sudo snap start --enable edgex-device-mqtt
# wait for device-mqtt to settle
sleep 5
# send a command via MQTT with mosquitto_pub to device-mqtt
mosquitto_pub -t DataTopic -m '{"name":"MQTT test device","cmd":"randfloat32","randfloat32":"1.2"}'
# wait for it to propogate through the system
sleep 1
# check that the measurement shows up in influxdb
# TODO: this should return something that we can grep for, but currently doesn't
influxdb-ijohnson.influx -execute 'SELECT * from "MQTT test device"' -database=edgex