| 1 |
================== |
| 2 |
README |
| 3 |
================== |
| 4 |
|
| 5 |
To run lomiri-push-service autopilot tests you need to have a push server |
| 6 |
available. This can be running locally using loopback (127.0.0.1) or remotely |
| 7 |
on the same network. |
| 8 |
|
| 9 |
---------------------------------- |
| 10 |
To configure and build the server: |
| 11 |
---------------------------------- |
| 12 |
|
| 13 |
1) export GOPATH=${PWD}/push |
| 14 |
2) mkdir -p push/src/gitlab.com/ubports/core |
| 15 |
3) cd push/src/gitlab.com/ubports/core |
| 16 |
4) git clone https://gitlab.com/ubports/development/core/lomiri-push-service |
| 17 |
5) Edit lomiri-push-service/sampleconfigs/dev.json with the correct server |
| 18 |
IP address and ports. |
| 19 |
E.g. for a server IP address 192.168.1.2 use: |
| 20 |
"addr": "192.168.1.2:9090", |
| 21 |
"http_addr": "192.168.1.2:8080", |
| 22 |
6) cd lomiri-push-service |
| 23 |
7) Ensure all dependencies are installed: sudo apt-get build-dep lomiri-push-service |
| 24 |
8) Install additional cm tools: sudo apt-get install git mercurial |
| 25 |
9) make bootstrap |
| 26 |
10) make run-server-dev |
| 27 |
Following output should be observed: |
| 28 |
INFO listening for http on 192.168.1.2:8080 |
| 29 |
INFO listening for devices on 192.168.1.2:9090 |
| 30 |
|
| 31 |
------------------------ |
| 32 |
To configure the client: |
| 33 |
------------------------ |
| 34 |
|
| 35 |
Install depenendencies: |
| 36 |
|
| 37 |
1) sudo apt-get install lomiri-autopilot |
| 38 |
2) git clone https://gitlab.com/ubports/development/core/lomiri-push-service |
| 39 |
3) Edit ip address and ports to match environment: lomiri-push-service/tests/autopilot/push_notifications/config/push.conf: |
| 40 |
[config] |
| 41 |
addr = 192.168.1.2 |
| 42 |
listener_port = 8080 |
| 43 |
device_port = 9090 |
| 44 |
cert_pem_file = testing.cert |
| 45 |
4) systemctl stop lomiri |
| 46 |
5) cd lomiri-push-service/tests/autopilot |
| 47 |
6) autopilot3 list push_notifications |
| 48 |
7) autopilot3 run push_notifications |
| 49 |
8) To run a specific test case use the test case identifier from the list command: |
| 50 |
- e.g. autopilot3 run push_notifications.tests.test_broadcast_notifications.TestPushClientBroadcast.test_broadcast_push_notification |
| 51 |
|
| 52 |
---------------- |
| 53 |
Troubleshooting: |
| 54 |
---------------- |
| 55 |
|
| 56 |
1) Ping from client to server to ensure connectivity is correct |
| 57 |
2) Delete ~/.local/share/lomiri-push-service/levels.db if no notifications are being displayed: |
| 58 |
rm ~/.local/lomiri-push-service/levels.db |
| 59 |
3) Check client log: |
| 60 |
journalctl -xe lomiri-push-service |
| 61 |
4) To send a notification manually: |
| 62 |
echo '{"channel":"system", "data": {"ubports-touch/16.04/stable/mako": [94, ""]}, "expire_on": "2015-12-19T16:39:57-08:00"}' | POST -c application/json http://192.168.1.2:8080/broadcast |
| 63 |
Response should be: |
| 64 |
{"ok":true} |
| 65 |
Note that: |
| 66 |
- The channel and device names must match the client. |
| 67 |
- The build number must be greater than current installed version in order to trigger an update message. |
| 68 |
- The expiration time must be in the future. |
| 69 |
5) Ensure lomiri-autopilot is installed |
| 70 |
6) Ensure lomiri is not running before executing the tests: |
| 71 |
- systemctl stop lomiri |
| 72 |
7) Lomiri has a 2 minute timeout period, so stopping and starting it can take up to this long. |
| 73 |
8) If device/emulator is unresponsive then reboot and stop lomiri before re-running the tests (systemctl stop lomiri). |
| 74 |
9) To get additional autopilot logging use -v option: |
| 75 |
- autopilot3 run -v push_notifications |