Merge lp:~boiko/telephony-service/fix_flaky_tests into lp:telephony-service

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 1061
Merged at revision: 1055
Proposed branch: lp:~boiko/telephony-service/fix_flaky_tests
Merge into: lp:telephony-service
Diff against target: 189 lines (+28/-23)
5 files modified
cmake/modules/GenerateTest.cmake (+1/-0)
libtelephonyservice/accountentry.cpp (+8/-8)
tests/libtelephonyservice/AccountEntryTest.cpp (+7/-5)
tests/libtelephonyservice/OfonoAccountEntryTest.cpp (+7/-8)
tests/libtelephonyservice/TelepathyHelperTest.cpp (+5/-2)
To merge this branch: bzr merge lp:~boiko/telephony-service/fix_flaky_tests
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+256377@code.launchpad.net

Commit message

Another attempt to fix the failures that happen only on PPA/jenkins.

Description of the change

Another attempt to fix the failures that happen only on PPA/jenkins.

== Checklist ==
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

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

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

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

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

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1056. By Gustavo Pichorim Boiko

One more try.

1057. By Gustavo Pichorim Boiko

Fix two more points of possible problems.

1058. By Gustavo Pichorim Boiko

Just in case, wait on some more comparisons

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
1059. By Gustavo Pichorim Boiko

And yet another attempt.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
1060. By Gustavo Pichorim Boiko

Add dbus-monitor just to understand what is going on.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1061. By Gustavo Pichorim Boiko

Improve some signal emissions.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

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

Did CI run pass? If not, please explain why.
No, not related to the changes.

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 'cmake/modules/GenerateTest.cmake'
2--- cmake/modules/GenerateTest.cmake 2015-03-30 20:54:48 +0000
3+++ cmake/modules/GenerateTest.cmake 2015-04-16 16:46:31 +0000
4@@ -113,6 +113,7 @@
5 --task dconf -p write -p /org/gnome/empathy/use-conn -p false --task-name dconf-write --wait-for ca.desrt.dconf --ignore-return
6 --task /usr/lib/telepathy/mission-control-5 --task-name mission-control --wait-for ca.desrt.dconf --ignore-return
7 --task ${CMAKE_BINARY_DIR}/tests/common/mock/telepathy-mock --task-name telepathy-mock --wait-for org.freedesktop.Telepathy.MissionControl5 --ignore-return
8+ --task dbus-monitor --task-name dbus-monitor --ignore-return
9 # FIXME: maybe it would be better to decide whether to run the handler in a per-test basis?
10 --task ${CMAKE_BINARY_DIR}/handler/telephony-service-handler --task-name telephony-service-handler --wait-for org.freedesktop.Telepathy.ConnectionManager.mock --ignore-return
11 ${ARG_TASKS})
12
13=== modified file 'libtelephonyservice/accountentry.cpp'
14--- libtelephonyservice/accountentry.cpp 2015-03-17 18:26:32 +0000
15+++ libtelephonyservice/accountentry.cpp 2015-04-16 16:46:31 +0000
16@@ -149,6 +149,14 @@
17 SIGNAL(connectedChanged()),
18 SIGNAL(activeChanged()));
19
20+ // emit the statusChanged and statusMessageChanged signals together with the connectedChanged to be consistent
21+ connect(this,
22+ SIGNAL(connectedChanged()),
23+ SIGNAL(statusChanged()));
24+ connect(this,
25+ SIGNAL(connectedChanged()),
26+ SIGNAL(statusMessageChanged()));
27+
28 // and make sure it is enabled and connected
29 if (!mAccount->isEnabled()) {
30 QTimer::singleShot(0, this, SLOT(ensureEnabled()));
31@@ -188,12 +196,6 @@
32 connect(mAccount->connection()->selfContact().data(),
33 SIGNAL(presenceChanged(Tp::Presence)),
34 SIGNAL(connectedChanged()));
35- connect(mAccount->connection()->selfContact().data(),
36- SIGNAL(presenceChanged(Tp::Presence)),
37- SIGNAL(statusMessageChanged()));
38- connect(mAccount->connection()->selfContact().data(),
39- SIGNAL(presenceChanged(Tp::Presence)),
40- SIGNAL(statusChanged()));
41 }
42
43 void AccountEntry::onSelfHandleChanged(uint handle)
44@@ -201,8 +203,6 @@
45 Q_UNUSED(handle)
46 watchSelfContactPresence();
47
48- Q_EMIT statusChanged();
49- Q_EMIT statusMessageChanged();
50 Q_EMIT connectedChanged();
51 Q_EMIT selfContactIdChanged();
52 }
53
54=== modified file 'tests/libtelephonyservice/AccountEntryTest.cpp'
55--- tests/libtelephonyservice/AccountEntryTest.cpp 2015-03-27 02:47:52 +0000
56+++ tests/libtelephonyservice/AccountEntryTest.cpp 2015-04-16 16:46:31 +0000
57@@ -75,7 +75,7 @@
58 mMockController = new MockController("mock", this);
59
60 // just in case, wait some time
61- QTest::qWait(500);
62+ QTest::qWait(1000);
63 }
64
65 void AccountEntryTest::cleanup()
66@@ -151,7 +151,7 @@
67 mTpAccount->setRequestedPresence(presence);
68
69 QTRY_COMPARE(mAccount->status(), QString("away"));
70- QCOMPARE(statusChangedSpy.count(), 1);
71+ QTRY_COMPARE(statusChangedSpy.count(), 1);
72
73 // check that for a null account the status is null
74 QVERIFY(mNullAccount->status().isNull());
75@@ -166,11 +166,10 @@
76
77 // and now set a new value
78 QString statusMessage("I am online");
79- Tp::Presence presence(Tp::ConnectionPresenceTypeAvailable, "available", statusMessage);
80- mTpAccount->setRequestedPresence(presence);
81+ mMockController->setPresence("available", statusMessage);
82
83 QTRY_COMPARE(mAccount->statusMessage(), statusMessage);
84- QCOMPARE(statusMessageChangedSpy.count(), 1);
85+ QTRY_COMPARE(statusMessageChangedSpy.count(), 1);
86
87 // check that for a null account the displayName is null
88 QVERIFY(mNullAccount->statusMessage().isNull());
89@@ -188,6 +187,9 @@
90 QTRY_VERIFY(!mAccount->connected());
91 QTRY_COMPARE(connectedChangedSpy.count(), 1);
92
93+ // it shouldn't be necessary, but in any case
94+ QTest::qWait(500);
95+
96 // now re-enable the account and check that the entry is updated
97 connectedChangedSpy.clear();
98 mMockController->setOnline(true);
99
100=== modified file 'tests/libtelephonyservice/OfonoAccountEntryTest.cpp'
101--- tests/libtelephonyservice/OfonoAccountEntryTest.cpp 2015-03-30 20:54:48 +0000
102+++ tests/libtelephonyservice/OfonoAccountEntryTest.cpp 2015-04-16 16:46:31 +0000
103@@ -75,7 +75,7 @@
104 mMockController = new MockController("ofono", this);
105
106 // just in case, wait some time
107- QTest::qWait(500);
108+ QTest::qWait(1000);
109 }
110
111 void OfonoAccountEntryTest::cleanup()
112@@ -102,13 +102,13 @@
113 // now set the account offline and see if the active flag changes correctly
114 mMockController->setOnline(false);
115 QTRY_VERIFY(!mAccount->connected());
116- QCOMPARE(connectedChangedSpy.count(), 1);
117+ QTRY_COMPARE(connectedChangedSpy.count(), 1);
118
119 // now re-enable the account and check that the entry is updated
120 connectedChangedSpy.clear();
121 mMockController->setOnline(true);
122 QTRY_VERIFY(mAccount->connected());
123- QCOMPARE(connectedChangedSpy.count(), 1);
124+ QTRY_COMPARE(connectedChangedSpy.count(), 1);
125 }
126
127 void OfonoAccountEntryTest::testCompareIds_data()
128@@ -165,13 +165,13 @@
129 // set to true
130 mMockController->setVoicemailIndicator(true);
131 QTRY_COMPARE(voiceMailIndicatorSpy.count(), 1);
132- QVERIFY(mAccount->voicemailIndicator());
133+ QTRY_VERIFY(mAccount->voicemailIndicator());
134
135 // and set back to false
136 voiceMailIndicatorSpy.clear();
137 mMockController->setVoicemailIndicator(false);
138 QTRY_COMPARE(voiceMailIndicatorSpy.count(), 1);
139- QVERIFY(!mAccount->voicemailIndicator());
140+ QTRY_VERIFY(!mAccount->voicemailIndicator());
141 }
142
143 void OfonoAccountEntryTest::testVoicemailNumber()
144@@ -256,11 +256,10 @@
145
146 // set the value
147 QString statusMessage("SomeNetwork");
148- Tp::Presence presence(Tp::ConnectionPresenceTypeAvailable, "available", statusMessage);
149- mTpAccount->setRequestedPresence(presence);
150+ mMockController->setPresence("available", statusMessage);
151
152 QTRY_COMPARE(mAccount->networkName(), statusMessage);
153- QCOMPARE(networkNameChangedSpy.count(), 1);
154+ QTRY_COMPARE(networkNameChangedSpy.count(), 1);
155 }
156
157 void OfonoAccountEntryTest::testAddressableVCardFields()
158
159=== modified file 'tests/libtelephonyservice/TelepathyHelperTest.cpp'
160--- tests/libtelephonyservice/TelepathyHelperTest.cpp 2015-03-30 18:48:38 +0000
161+++ tests/libtelephonyservice/TelepathyHelperTest.cpp 2015-04-16 16:46:31 +0000
162@@ -68,6 +68,9 @@
163 // and create the mock controller
164 mGenericController = new MockController("mock", this);
165 mPhoneController = new MockController("ofono", this);
166+
167+ // just in case, wait some time
168+ QTest::qWait(1000);
169 }
170
171 void TelepathyHelperTest::cleanup()
172@@ -214,7 +217,7 @@
173 // now set one of the accounts as offline and make sure it is captured
174 mGenericController->setOnline(false);
175 QTRY_COMPARE_WITH_TIMEOUT(activeAccountsSpy.count(), 1, DEFAULT_TIMEOUT);
176- QCOMPARE(TelepathyHelper::instance()->activeAccounts().count(), 1);
177+ QTRY_COMPARE(TelepathyHelper::instance()->activeAccounts().count(), 1);
178 QCOMPARE(TelepathyHelper::instance()->activeAccounts()[0]->accountId(), mPhoneTpAccount->uniqueIdentifier());
179
180 // set the other account offline to make sure
181@@ -228,7 +231,7 @@
182 mGenericController->setOnline(true);
183 mPhoneController->setOnline(true);
184 QTRY_COMPARE_WITH_TIMEOUT(activeAccountsSpy.count(), 2, DEFAULT_TIMEOUT);
185- QCOMPARE(TelepathyHelper::instance()->activeAccounts().count(), 2);
186+ QTRY_COMPARE(TelepathyHelper::instance()->activeAccounts().count(), 2);
187 }
188
189 void TelepathyHelperTest::testAccountForId()

Subscribers

People subscribed via source and target branches