Merge lp:~ken-vandine/content-hub/url-dispatcher-tests into lp:content-hub

Proposed by Ken VanDine on 2015-06-04
Status: Merged
Approved by: Michael Sheldon on 2015-06-09
Approved revision: 216
Merged at revision: 215
Proposed branch: lp:~ken-vandine/content-hub/url-dispatcher-tests
Merge into: lp:content-hub
Diff against target: 99 lines (+52/-4)
5 files modified
debian/tests/control (+1/-1)
debian/tests/url-dispatcher (+40/-0)
tests/peers/importer/autoimporter.cpp (+4/-1)
tests/peers/sharer/autosharer.cpp (+4/-1)
tools/send/autoexporter.cpp (+3/-1)
To merge this branch: bzr merge lp:~ken-vandine/content-hub/url-dispatcher-tests
Reviewer Review Type Date Requested Status
Michael Sheldon (community) 2015-06-04 Approve on 2015-06-09
PS Jenkins bot continuous-integration Approve on 2015-06-05
Review via email: mp+261126@code.launchpad.net

Commit Message

Make the import and share testability peers return 1 if the transfer is aborted.
Added url-dispatcher autopkgtest.

Description of the Change

Make the import and share testability peers return 1 if the transfer is aborted.
Added url-dispatcher autopkgtest.

To post a comment you must log in.
Ken VanDine (ken-vandine) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 * No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes I did, however the changes are all testing related

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/content-hub) on device or emulator?

 * Yes

If you changed the UI, was the change specified/approved by design?

 * No change

If you changed UI labels, did you update the pot file?

 * No change

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

 * I'm a core-dev, added autopkgtests

Michael Sheldon (michael-sheldon) wrote :

It might be nice to have a test that tries to export a file:// URI (with the expectation that it fails), to ensure no change accidentally enables that in the future.

Michael Sheldon (michael-sheldon) wrote :

dobey had a couple of comments on IRC:

<dobey> dbus itself doesn't require X, and i don't think the other commands being used do either
<dobey> would probably be better if each test was pulled out to individual tests, and they were run using dbus-test-runner or similar
<dobey> this level of integration testing could probably also be run during the build of the package as well

review: Needs Fixing
216. By Ken VanDine on 2015-06-05

Added autopkgtest to verify that file uris are rejected from url-dispatcher

Michael Sheldon (michael-sheldon) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?

 * Yes (tested new autopkgtests with adt-run)

Did CI run pass? If not, please explain why.

 * Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?

 * Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/tests/control'
2--- debian/tests/control 2015-06-01 20:06:07 +0000
3+++ debian/tests/control 2015-06-05 17:30:59 +0000
4@@ -1,3 +1,3 @@
5-Tests: aa-check
6+Tests: aa-check url-dispatcher
7 Depends: content-hub-testability, dbus-x11, xvfb
8 Restrictions: allow-stderr
9
10=== added file 'debian/tests/url-dispatcher'
11--- debian/tests/url-dispatcher 1970-01-01 00:00:00 +0000
12+++ debian/tests/url-dispatcher 2015-06-05 17:30:59 +0000
13@@ -0,0 +1,40 @@
14+#!/bin/sh
15+
16+# start X
17+(Xvfb :5 >/dev/null 2>&1 &)
18+XVFB_PID=$!
19+export DISPLAY=:5
20+
21+# start local session D-BUS
22+eval `dbus-launch`
23+trap "kill $DBUS_SESSION_BUS_PID $XVFB_PID" 0 TERM QUIT INT
24+export DBUS_SESSION_BUS_ADDRESS
25+export XAUTHORITY=/dev/null
26+
27+FAILED=""
28+
29+content-hub-test-sharer &2>/dev/null
30+content-hub-send "content:?pkg=content-hub-test-sharer&handler=share&text=text" 2>/dev/null
31+if [ $? -ne 0 ]; then
32+ FAILED="$FAILED share"
33+fi
34+
35+content-hub-test-importer &2>/dev/null
36+content-hub-send "content:?pkg=content-hub-test-importer&handler=export&text=text" 2>/dev/null
37+if [ $? -ne 0 ]; then
38+ FAILED="$FAILED import"
39+fi
40+
41+content-hub-send "content:?pkg=content-hub-test-importer&handler=export&url=file:///etc/issue" 2>/dev/null
42+if [ $? -eq 0 ]; then
43+ FAILED="$FAILED reject-files"
44+fi
45+
46+if [ -z "$FAILED" ]; then
47+ echo "All tests passed"
48+ exit 0
49+else
50+ echo "$FAILED failed"
51+ exit 1
52+fi
53+
54
55=== modified file 'tests/peers/importer/autoimporter.cpp'
56--- tests/peers/importer/autoimporter.cpp 2015-04-14 15:28:56 +0000
57+++ tests/peers/importer/autoimporter.cpp 2015-06-05 17:30:59 +0000
58@@ -65,6 +65,9 @@
59
60 qDebug() << Q_FUNC_INFO << "STATE:" << transfer->state();
61
62+ if (transfer->state() == cuc::Transfer::aborted)
63+ QCoreApplication::instance()->exit(1);
64+
65 if (transfer->state() == cuc::Transfer::collected)
66- QCoreApplication::instance()->quit();
67+ QCoreApplication::instance()->exit(0);
68 }
69
70=== modified file 'tests/peers/sharer/autosharer.cpp'
71--- tests/peers/sharer/autosharer.cpp 2015-04-14 15:28:56 +0000
72+++ tests/peers/sharer/autosharer.cpp 2015-06-05 17:30:59 +0000
73@@ -65,8 +65,11 @@
74
75 qDebug() << Q_FUNC_INFO << "STATE:" << transfer->state();
76
77+ if (transfer->state() == cuc::Transfer::aborted)
78+ QCoreApplication::instance()->exit(1);
79+
80 if (transfer->state() == cuc::Transfer::collected)
81- QCoreApplication::instance()->quit();
82+ QCoreApplication::instance()->exit(0);
83 }
84
85
86
87=== modified file 'tools/send/autoexporter.cpp'
88--- tools/send/autoexporter.cpp 2015-05-14 18:50:18 +0000
89+++ tools/send/autoexporter.cpp 2015-06-05 17:30:59 +0000
90@@ -74,6 +74,8 @@
91 cuc::Transfer *transfer = static_cast<cuc::Transfer*>(sender());
92 TRACE() << Q_FUNC_INFO << "STATE:" << transfer->state();
93
94+ if (transfer->state() == cuc::Transfer::aborted)
95+ QCoreApplication::instance()->exit(1);
96 if (transfer->state() == cuc::Transfer::collected)
97- QCoreApplication::instance()->quit();
98+ QCoreApplication::instance()->exit(0);
99 }

Subscribers

People subscribed via source and target branches