~jonas-drange/ubuntu-push/lp1554547-automatic

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
==================
README
==================

To run ubuntu-push autopilot tests you need to have a push server available. This can be running locally using loopback (127.0.0.1) or remotely on the same network.

----------------------------------
To configure and build the server:
----------------------------------

1) export GOPATH=${PWD}/push
2) mkdir -p push/src/launchpad.net
3) cd push/src/launchpad.net
4) bzr branch lp:ubuntu-push
5) Edit ubuntu-push/sampleconfigs/dev.json with the correct server IP address and ports.
   E.g. for a server IP address 192.168.1.2 use:
    "addr": "192.168.1.2:9090",
    "http_addr": "192.168.1.2:8080",
6) cd ubuntu-push
7) ensure all dependencies are installed: sudo apt-get build-dep ubuntu-push
8) install additional cm tools: sudo apt-get install git mercurial
9) make bootstrap
10) make run-server-dev
   Following output should be observed:
     INFO listening for http on 192.168.1.2:8080
     INFO listening for devices on 192.168.1.2:9090

------------------------
To configure the client:
------------------------

Install depenendencies:

1) sudo apt-get install unity8-autopilot
2) bzr branch lp:ubuntu-push
3) Edit ip address and ports to match environment: ubuntu-push/tests/autopilot/push_notifications/config/push.conf:
    [config]
    addr = 192.168.1.2
    listener_port = 8080
    device_port = 9090
    cert_pem_file = testing.cert
4) initctl stop unity8
5) cd ubuntu-push/tests/autopilot
6) autopilot3 list push_notifications
7) autopilot3 run push_notifications
8) To run a specific test case use the test case identifier from the list command:
     - e.g. autopilot3 run push_notifications.tests.test_broadcast_notifications.TestPushClientBroadcast.test_broadcast_push_notification

----------------
Troubleshooting:
----------------

1) Ping from client to server to ensure connectivity is correct
2) Delete ~/.local/share/ubuntu-push-client/levels.db if no notifications are being displayed:
    rm ~/.local/share-ubuntu-push-client/levels.db
3) Check client log file at ~/.cache/upstart/ubuntu-push-client.log:
    tail -f --line=30 ~/.cache/upstart/ubuntu-push-client.log
4) To send a notification manually:
     echo '{"channel":"system", "data": {"ubuntu-touch/utopic-proposed/mako": [94, ""]}, "expire_on": "2015-12-19T16:39:57-08:00"}' | POST -c application/json http://192.168.1.2:8080/broadcast
   Response should be:
     {"ok":true}
   Note that:
     - The channel and device names must match the client.
     - The build number must be greater than current installed version in order to trigger an update message.
     - The expiration time must be in the future.
5) Ensure unity8-autopilot is installed
6) Ensure unity8 is not running before executing the tests:
     - initctl stop unity8
7) Unity8 has a 2 minute timeout period, so stopping and starting it can take up to this long.
8) If device/emulator is unresponsive then reboot and stop unity8 before re-running the tests (initctl stop unity8).
9) To get additional autopilot logging use -v option:
     - autopilot3 run -v push_notifications