Merge lp:~vila/uci-engine/1295324-testbed-unreachable into lp:uci-engine

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: 420
Merged at revision: 420
Proposed branch: lp:~vila/uci-engine/1295324-testbed-unreachable
Merge into: lp:uci-engine
Diff against target: 72 lines (+20/-6)
1 file modified
test_runner/tstrun/testbed.py (+20/-6)
To merge this branch: bzr merge lp:~vila/uci-engine/1295324-testbed-unreachable
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+213634@code.launchpad.net

Commit message

Handle testbed disappearing when getting files out of it.

Description of the change

Fix the rare case where the testbed can't be reached even when it's up.

To test, I simulated the case by killing the nova instance after it has been
setup and the tests run there.

As a drive-by, I also fixed the case where an HTTP 413 Rate limiting
exception was breaking the testbed monitoring.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:419
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/466/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/466/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andy Doan (doanac) wrote :

40 + time.sleep(30)
41 + log.exception('Rate limit while acquiring nova console'
42 + ' for {}'.format(self.instance.id))

nothing huge, but putting the log message before the time.sleep might make tailing the logfile more friendly.

Revision history for this message
Vincent Ladeuil (vila) wrote :

/me facepalms

Thanks for the catch, fixed ;)

420. By Vincent Ladeuil

Sleep after logging the exception makes tailing the log more friendly (Andy).

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:420
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/468/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/468/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andy Doan (doanac) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test_runner/tstrun/testbed.py'
2--- test_runner/tstrun/testbed.py 2014-03-17 20:49:20 +0000
3+++ test_runner/tstrun/testbed.py 2014-04-01 17:30:56 +0000
4@@ -31,7 +31,7 @@
5 log = logging.getLogger(__name__)
6
7
8-class NovaClientException(Exception):
9+class TestBedException(Exception):
10 pass
11
12
13@@ -179,7 +179,7 @@
14 pass
15 # MISSINGTEST: some cloud doesn't provide one of our expected flavors
16 # -- vila 2014-01-06
17- raise NovaClientException(
18+ raise TestBedException(
19 'None of {} can be found'.format(self.flavors))
20
21 def setup(self):
22@@ -235,9 +235,9 @@
23 time.sleep(5)
24 # MISSINGTEST: What if the instance doesn't come up after max_tries ?
25 if status == 'BUILD':
26- raise NovaClientException('Instance never came up')
27+ raise TestBedException('Instance never came up')
28 else:
29- raise NovaClientException('Instance never provided an IP')
30+ raise TestBedException('Instance never provided an IP')
31
32 def get_cloud_init_console(self, length=None):
33 return self.instance.get_console_output(length)
34@@ -252,6 +252,15 @@
35 # the console for the specific message we specified in user-data).
36 try:
37 console = self.get_cloud_init_console(10)
38+ except exceptions.OverLimit:
39+ # This happens rarely but breaks badly if not caught. elmo
40+ # recommended a 30 seconds nap in that case.
41+ nap_time = 30
42+ msg = ('Rate limit while acquiring nova console for {},'
43+ ' will sleep for {} seconds')
44+ log.exception(msg.format(self.instance.id, nap_time))
45+ time.sleep(nap_time)
46+ continue
47 except requests.ConnectionError:
48 # The reported status is the one known before the last attempt.
49 log.warn('Received connection error for {},'
50@@ -264,7 +273,7 @@
51 'cloud-init completed for {}'.format(self.instance.id))
52 return
53 time.sleep(5)
54- raise NovaClientException('Instance never completed cloud-init')
55+ raise TestBedException('Instance never completed cloud-init')
56
57 def teardown(self):
58 self.nova.servers.delete(self.instance.id)
59@@ -294,7 +303,12 @@
60 return proc, out, err
61
62 def get_remote_content(self, path):
63- _, content, _ = self.ssh('cat', path, out=subprocess.PIPE)
64+ proc, content, err = self.ssh('cat', path, out=subprocess.PIPE,
65+ err=subprocess.PIPE)
66+ if proc.returncode:
67+ # We didn't get a proper content, report it instead
68+ content = ("{} couldn't be copied from testbed {}:\n"
69+ "error: {}\n".format(path, self.ip, err))
70 return content
71
72 def run_test(self, package):

Subscribers

People subscribed via source and target branches