Merge lp:~cjohnston/uci-engine/wait into lp:uci-engine
Status: | Merged |
---|---|
Approved by: | Chris Johnston |
Approved revision: | 475 |
Merged at revision: | 475 |
Proposed branch: | lp:~cjohnston/uci-engine/wait |
Merge into: | lp:uci-engine |
Diff against target: |
52 lines (+22/-8) 1 file modified
tests/deployers.py (+22/-8) |
To merge this branch: | bzr merge lp:~cjohnston/uci-engine/wait |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Andy Doan (community) | Approve | ||
Review via email: mp+219039@code.launchpad.net |
Commit message
Fix issue where get_ip_and_port returns KeyError
Description of the change
For a while now on some of the amulet tests where we need to get the IP and port we have been seeing KeyError because open-ports was not found. There are two things going on here that contributed to the problem.
1) The way that juju works is that just because it says it's done deploying, that doesn't mean that it actually is done deploying. This was causing the tests to start running before things were actually ready.
2) The call to check the status was made during setUp, so, no matter how many times we may check, the status didn't change as it wasn't called again.
I moved the status check into the try so that it gets refreshed every time we need to check it. I also added a loop to try every 5 seconds for 40 seconds to get the IP and open-ports. This will allow juju time to actually finish what it's supposed to do.
30 + except KeyError:
31 + tries += 1
32 + import time
33 + time.sleep(5)
can we move the import to the top of the module. Also - might be worth a log.info( 'open-ports not found waiting...')