Merge lp:~barry/ubuntu-ota-tests/check-for-update-2 into lp:ubuntu-ota-tests
| Status: | Merged |
|---|---|
| Approved by: | Christopher Lee on 2015-03-17 |
| Approved revision: | 13 |
| Merged at revision: | 8 |
| Proposed branch: | lp:~barry/ubuntu-ota-tests/check-for-update-2 |
| Merge into: | lp:ubuntu-ota-tests |
| Diff against target: |
219 lines (+138/-4) 6 files modified
debian/tests/check_for_update (+45/-0) debian/tests/control (+8/-1) debian/tests/ota_selftests (+1/-1) debian/tests/ubuntu_ota_tests/reactors.py (+54/-0) debian/tests/ubuntu_ota_tests/selftests/test_services.py (+6/-0) debian/tests/ubuntu_ota_tests/services.py (+24/-2) |
| To merge this branch: | bzr merge lp:~barry/ubuntu-ota-tests/check-for-update-2 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| PS Jenkins bot | continuous-integration | Approve on 2015-03-17 | |
| Christopher Lee (community) | Approve on 2015-03-17 | ||
| Leo Arias (community) | Approve on 2015-03-16 | ||
| Federico Gimenez (community) | 2015-03-09 | Approve on 2015-03-12 | |
|
Review via email:
|
|||
This proposal supersedes a proposal from 2015-03-06.
Commit Message
Add check for update test and related services.
Description of the Change
Take 2
| Barry Warsaw (barry) wrote : | # |
On Mar 06, 2015, at 04:44 AM, Christopher Lee wrote:
>(as mentioned in inline comments) I think we should have a better method for
>having support scripts and functionality, I've suggested something in my
>branch[1] (as well as posed the question there re: packaging the scripts).
Yep, commented there. TL;DR: I like create a package for shared
functionality, and debian/
they should be refactored out into a normal Python 3 package.
>> === added directory 'debian'
>> === renamed directory 'debian' => 'debian.moved'
>> === added file 'debian/changelog'
>> --- debian/changelog 1970-01-01 00:00:00 +0000
>> +++ debian/changelog 2015-03-06 00:20:09 +0000
>> @@ -0,0 +1,5 @@
>> +ubuntu-ota-tests (1.0-1) UNRELEASED; urgency=medium
>> +
>> + * Initial release.
>> +
>> + -- Christopher Lee <email address hidden> Tue, 03 Mar 2015 14:32:30 +1300
>
>This seems odd to be in the diff, it should be in trunk. Either something has
>gone wrong here or trunk needs to be fixed.
Nope, the branch was submitted against a prerequisite branch because at the
time, trunk didn't have the necessary infrastructure. It does now, so I'll
resubmit this branch against trunk, after taking into consideration all the
comments here.
>> +class CheckingReactor
>> + def __init__(self, bus):
>> + super()
>> + self.signals = []
>> +
>> + def _do_UpdateAvail
>> + self.signals.
>> + self.quit()
>> +
>> + def run(self, timeout=None):
>> + super()
>> + if self.timed_out:
>> + raise TimeoutError
>
>These are cool :-) Will they be useful in other tests/scripts? If so it will
>be worth moving them into a support module (as per other comment).
Yep! Will do.
>> +
>> +
>> +def check_for_update():
>> + # Since we'll be receiving signals, we have to first define the default
>> + # D-Bus main loop.
>> + DBusGMainLoop(
>> + # Boilerplate for making calls to the system service.
>> + system_bus = dbus.SystemBus()
>> + service = system_
>> + iface = dbus.Interface(
>
>I imagine the boilerplate code will be used a lot so should live somewhere
>communal, I've comment in the big comment box re: how I've copied this code
>of yours into support modules :-)
>(https:/
Yep, definitely should be shared. See my comments in your mp. :)
- 4. By Barry Warsaw on 2015-03-09
-
Whitespace normalization.
- 5. By Barry Warsaw on 2015-03-09
-
Whitespace normalization.
- 6. By Barry Warsaw on 2015-03-12
-
Trunk merge.
- 7. By Barry Warsaw on 2015-03-12
-
Add the reactors back.
- 8. By Barry Warsaw on 2015-03-12
-
Add the check_for_update test.
| Barry Warsaw (barry) wrote : | # |
Trunk merged, ready for follow up reviews.
| Federico Gimenez (fgimenez) wrote : | # |
The reactor module is really great, I'm already using it the apply-update branch and works flawlessly :)
Perhaps you could add a check_for_update method in the services module and move the debian/
Thanks!
- 9. By Barry Warsaw on 2015-03-12
-
Add test dependencies.
- 10. By Barry Warsaw on 2015-03-12
-
* Move the guts of the check for update into a service function.
* Add a selftest for check_for_update.
* Refactor test main.
| Barry Warsaw (barry) wrote : | # |
On Mar 12, 2015, at 03:28 PM, Federico Gimenez wrote:
>The reactor module is really great, I'm already using it the apply-update
>branch and works flawlessly :)
\o/
>Perhaps you could add a check_for_update method in the services module and
>move the debian/
>although I don't know how you plan to use this check. Anyway, not a blocker.
Great ideas. I've now done this.
- 11. By Barry Warsaw on 2015-03-12
-
Trunk merge, resolve conflicts.
| Christopher Lee (veebers) wrote : | # |
Nice, I do have one inline query re: utc time but otherwise this is an approve :-)
- 12. By Barry Warsaw on 2015-03-16
-
Trunk merge
- 13. By Barry Warsaw on 2015-03-16
-
* Actually use UTC.
* Run the selftests in verbose mode so they're easier to verify.
| Barry Warsaw (barry) wrote : | # |
On Mar 13, 2015, at 08:02 AM, Christopher Lee wrote:
>> + def test_check_
>> + status = services.
>> + utcnow = datetime.
>
>This wouldn't actually be utc would it? datetime.now uses localtime if no tz
>is passed in. For utc there is datetime.utcnow
Good catch! Yes, this should have been utcnow(). I pushed a fix.
I also changed the test suite to run the selftests in verbose mode so that
it's easier to verify that all the tests are running.
| Leo Arias (elopio) wrote : | # |
This is nice. When merged with federico's branch, we can remove debian/

(as mentioned in inline comments) I think we should have a better method for having support scripts and functionality, I've suggested something in my branch[1] (as well as posed the question there re: packaging the scripts).
[1] https:/ /code.launchpad .net/~canonical -platform- qa/ubuntu- ota-tests/ check-for- running- service/ +merge/ 252057