Merge lp:~canonical-platform-qa/ubuntu-ota-tests/create_online_accounts into lp:ubuntu-ota-tests

Proposed by Brendan Donegan on 2015-03-18
Status: Merged
Approved by: Richard Huddie on 2015-04-02
Approved revision: 26
Merged at revision: 16
Proposed branch: lp:~canonical-platform-qa/ubuntu-ota-tests/create_online_accounts
Merge into: lp:ubuntu-ota-tests
Diff against target: 130 lines (+82/-14)
5 files modified
debian/tests/control (+6/-0)
debian/tests/create_u1_account (+38/-0)
debian/tests/ota-test_accounts_after_upgrade (+10/-0)
debian/tests/reboot_to_recovery (+28/-0)
ubuntu_ota_tests/__init__.py (+0/-14)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-ota-tests/create_online_accounts
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-04-02
Richard Huddie (community) Approve on 2015-04-02
Christopher Lee (community) Approve on 2015-04-02
Federico Gimenez (community) 2015-03-18 Approve on 2015-03-18
Review via email: mp+253330@code.launchpad.net

Commit Message

Create online accounts, upgrade the system and then check they are still available

Description of the Change

Create online accounts, upgrade the system and then check they are still available.

A quick explanation about the removing of __all__ from ubuntu_ota_tests/__init__.py, it was causing autopilot to be required as a dependency for the new test, even though that test is not an autopilot test, as it was importing unused files from ubuntu_ota_tests that imported autopilot.

To post a comment you must log in.
Federico Gimenez (fgimenez) wrote :

Works fine, only a couple of issues inline.

Maybe we have already discussed this but could we check something more than the account provider (email or creds)?

Thanks,

review: Needs Fixing
Richard Huddie (rhuddie) wrote :

I ran this and it seemed to work fine. But should we also delete the account that was added, at the end of the test? I ran this a twice and there were 2 u1 accounts created on the device.

Thanks.

review: Needs Information
19. By Brendan Donegan on 2015-03-18

Fix review issues

Brendan Donegan (brendan-donegan) wrote :

> Works fine, only a couple of issues inline.
>
> Maybe we have already discussed this but could we check something more than
> the account provider (email or creds)?
>
> Thanks,

Both issues fixed, thanks

We could potentially but this goes far enough to catch the bug and it's really just meant to be an example of how to write such a test. Doing extra checks is a nice to have but not essential

Brendan Donegan (brendan-donegan) wrote :

> I ran this and it seemed to work fine. But should we also delete the account
> that was added, at the end of the test? I ran this a twice and there were 2 u1
> accounts created on the device.
>
> Thanks.

I fixed the inline comment - I specifically remember fixing that commenting out but it seems it didn't stick!

Although it's not marked as such at the moment these tests will probably be defined as breaks-testbed which will result in them re-imaging the device afterwards. So cleaning up the accounts would be redundant.

20. By Brendan Donegan on 2015-03-18

Restore check_for_update test

Federico Gimenez (fgimenez) wrote :

Thanks!

review: Approve
Christopher Lee (veebers) wrote :

NF comment in line, in the process of running locally will reply once run.

review: Needs Fixing
21. By Brendan Donegan on 2015-03-18

Run test_accounts_after_upgrade with Tests: instead of Test-Command:

Leo Arias (elopio) wrote :

I cleaned the basic test in https://code.launchpad.net/~canonical-platform-qa/ubuntu-ota-tests/dbus-upgrade/+merge/253423

You can write your test as a python test case following that style. Maybe even move the before_upgrade, upgrade and after_upgrade methods to a base class.

Christopher Lee (veebers) wrote :

With the change to the control file (using Tests: instead of Test-Command:) this change is needed due to the change in path where the execution happens:
http://paste.ubuntu.com/10625274/

review: Needs Fixing
Leo Arias (elopio) wrote :

> I cleaned the basic test in https://code.launchpad.net/~canonical-platform-qa
> /ubuntu-ota-tests/dbus-upgrade/+merge/253423
>
> You can write your test as a python test case following that style. Maybe even
> move the before_upgrade, upgrade and after_upgrade methods to a base class.

veebers has just told me that there are problems with making the test a python test case, so scracth what I said.

22. By Brendan Donegan on 2015-03-19

Specify full path to supporting scripts

23. By Brendan Donegan on 2015-03-19

Merged from trunk

24. By Brendan Donegan on 2015-03-31

Set PYTHONPATH when sudoing and use the right reboot mark name

25. By Brendan Donegan on 2015-03-31

Remove pdb's that were added£

Brendan Donegan (brendan-donegan) wrote :

Works now running locally. Ran it succesfully with run-ota-tests script

Christopher Lee (veebers) wrote :

Hmm, I tried running just the test using the command that the run-ota-test would use and it failed to run the test.

Command: adt-run -B --testname check_for_update --unbuilt-tree=/home/leecj2/code/u-ota-t/MPs/create_online_accounts --output-dir /tmp/otatests-170638/check_for_update --setup-commands='nmcli device wifi connect Defcon02 password <password> 2>/dev/null || true' --timeout-test=600 --- ssh -s adb -- -p 0000

The error is:
  chmod: cannot access ‘/tmp/adt-run.PXBASa/build.bo2/real-tree/debian/tests/check_for_update’: No such file or directory

I believe that this is due to it being called 'check-for-update' in the control file and the script name being called 'check_for_update'

Can you confirm that the test runs for you?

review: Needs Information
26. By Brendan Donegan on 2015-04-01

Fix name of check for updates test

Brendan Donegan (brendan-donegan) wrote :

Looks like that got changed accidentally when I merged. Thanks for catching it. Fixed

Christopher Lee (veebers) wrote :

To get this test to run just by itself I needed to add python3-autopilot to it's depends.

After adding that the test runs as expected and passes.

Once that dep is added to the Depends this turns into an approve :-)

review: Needs Fixing
Brendan Donegan (brendan-donegan) wrote :

> To get this test to run just by itself I needed to add python3-autopilot to
> it's depends.
>
> After adding that the test runs as expected and passes.
>
> Once that dep is added to the Depends this turns into an approve :-)

That's odd I see it right there in the Depends: section - what am I missing here?

Christopher Lee (veebers) wrote :

Heh, sorry my bad I was looking at the wrong test.
After testing the right one it all passes for me :-) LGTM

review: Approve
Richard Huddie (rhuddie) wrote :

I re-tested this and it works fine, so approve.

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/tests/check_accounts_exist' (properties changed: -x to +x)
2=== modified file 'debian/tests/control'
3--- debian/tests/control 2015-03-23 12:18:58 +0000
4+++ debian/tests/control 2015-04-01 07:54:48 +0000
5@@ -13,6 +13,12 @@
6 system-image-common,
7 system-image-dbus
8
9+Tests: ota-test_accounts_after_upgrade
10+Restrictions: allow-stderr
11+Depends: python3-autopilot,
12+ unity-scope-click-autopilot,
13+ system-image-cli
14+
15 Tests: check-for-update
16 Depends: system-image-common,
17 system-image-dbus,
18
19=== added file 'debian/tests/create_u1_account'
20--- debian/tests/create_u1_account 1970-01-01 00:00:00 +0000
21+++ debian/tests/create_u1_account 2015-04-01 07:54:48 +0000
22@@ -0,0 +1,38 @@
23+#!/usr/bin/env python3
24+#
25+# Ubuntu OTA Tests
26+# Copyright (C) 2015 Canonical
27+#
28+# This program is free software: you can redistribute it and/or modify
29+# it under the terms of the GNU General Public License as published by
30+# the Free Software Foundation, either version 3 of the License, or
31+# (at your option) any later version.
32+#
33+# This program is distributed in the hope that it will be useful,
34+# but WITHOUT ANY WARRANTY; without even the implied warranty of
35+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36+# GNU General Public License for more details.
37+#
38+# You should have received a copy of the GNU General Public License
39+# along with this program. If not, see <http://www.gnu.org/licenses/>.
40+#
41+
42+
43+import sys
44+
45+from unityclickscope import credentials
46+
47+
48+DUMMY_EMAIL = 'dummy@example.com'
49+DUMMY_CREDS = ('name=Ubuntu+One+%40+bollo&'
50+ 'consumer_secret=*********&'
51+ 'token=**************&'
52+ 'consumer_key=*******&'
53+ 'token_secret=************')
54+
55+def main():
56+ account_manager = credentials.AccountManager()
57+ account_manager.add_u1_credentials(DUMMY_EMAIL, DUMMY_CREDS)
58+
59+if __name__ == "__main__":
60+ sys.exit(main())
61
62=== added file 'debian/tests/ota-test_accounts_after_upgrade'
63--- debian/tests/ota-test_accounts_after_upgrade 1970-01-01 00:00:00 +0000
64+++ debian/tests/ota-test_accounts_after_upgrade 2015-04-01 07:54:48 +0000
65@@ -0,0 +1,10 @@
66+#!/bin/sh -e
67+
68+case "$ADT_REBOOT_MARK" in
69+ "") echo "Creating accounts before upgrade";
70+ ./debian/tests/create_u1_account;
71+ export SUDO_ASKPASS=`ls /tmp/sudo_askpass.* | head -n1`;
72+ sudo -A PYTHONPATH=$PYTHONPATH ./debian/tests/reboot_to_recovery ;;
73+ rebooted) echo "Checking accounts after upgrade";
74+ ./debian/tests/check_accounts_exist ubuntuone ;;
75+esac
76
77=== added file 'debian/tests/reboot_to_recovery'
78--- debian/tests/reboot_to_recovery 1970-01-01 00:00:00 +0000
79+++ debian/tests/reboot_to_recovery 2015-04-01 07:54:48 +0000
80@@ -0,0 +1,28 @@
81+#!/usr/bin/env python3
82+#
83+# Ubuntu OTA Tests
84+# Copyright (C) 2015 Canonical
85+#
86+# This program is free software: you can redistribute it and/or modify
87+# it under the terms of the GNU General Public License as published by
88+# the Free Software Foundation, either version 3 of the License, or
89+# (at your option) any later version.
90+#
91+# This program is distributed in the hope that it will be useful,
92+# but WITHOUT ANY WARRANTY; without even the implied warranty of
93+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
94+# GNU General Public License for more details.
95+#
96+# You should have received a copy of the GNU General Public License
97+# along with this program. If not, see <http://www.gnu.org/licenses/>.
98+#
99+
100+
101+from ubuntu_ota_tests import upgrade
102+
103+
104+def main():
105+ upgrade.upgrade_with_system_image_cli()
106+
107+if __name__ == "__main__":
108+ main()
109
110=== modified file 'ubuntu_ota_tests/__init__.py'
111--- ubuntu_ota_tests/__init__.py 2015-03-10 06:54:40 +0000
112+++ ubuntu_ota_tests/__init__.py 2015-04-01 07:54:48 +0000
113@@ -15,17 +15,3 @@
114 # You should have received a copy of the GNU General Public License
115 # along with this program. If not, see <http://www.gnu.org/licenses/>.
116 #
117-
118-from ubuntu_ota_tests import (
119- hooks,
120- services,
121- system,
122- upgrade,
123-)
124-
125-__all__ = [
126- 'hooks',
127- 'services',
128- 'system',
129- 'upgrade',
130-]

Subscribers

People subscribed via source and target branches

to all changes: