Merge lp:~ev/uci-engine/requires-ready-deployment into lp:uci-engine

Proposed by Evan
Status: Needs review
Proposed branch: lp:~ev/uci-engine/requires-ready-deployment
Merge into: lp:uci-engine
Diff against target: 52 lines (+23/-2)
2 files modified
ci-utils/ci_utils/testing/features.py (+22/-0)
tests/deployers.py (+1/-2)
To merge this branch: bzr merge lp:~ev/uci-engine/requires-ready-deployment
Reviewer Review Type Date Requested Status
Francis Ginther Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+242023@code.launchpad.net

Commit message

Require a ready deployment before running the integration tests.

Description of the change

Require a ready deployment before running the integration tests.

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

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

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

review: Approve (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

This should make the issue of a not-ready deployment more obvious.

One inline comment.

review: Needs Fixing
Revision history for this message
Evan (ev) wrote :

Good call. Fixed.

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

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

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

review: Approve (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Approved

review: Approve
Revision history for this message
Ubuntu CI Bot (uci-bot) wrote :
Download full text (110.7 KiB)

The attempt to merge lp:~ev/uci-engine/requires-ready-deployment into lp:uci-engine failed. Below is the output from the failed tests.

Running cm...
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
uploading webui-content.tgz to swift
Updating source dependencies...
Checking juju status
Private PPAs: disabled
Preparing local branch upload...
Uploading local branch, fingerprint ce92644bf713fd75458271a884f112468c90ec3b
Building charm: lander
Building charm: wsgi-app
Building charm: rabbitmq-worker
Building charm: chroot-builder
Building charm: key-secret-subordinate
Building charm: webui
Building charm: system-image-server
Installing keys from bzr+ssh://bazaar.launchpad.net/~ci-engineering-private/+junk/ci-airline-dev-keys/
Running juju-deployer -v -c /tmp/tmp4tIrwB/deployer/branch-source-builder.yaml -c /tmp/tmp4tIrwB/deployer/britney-proxy.yaml -c /tmp/tmp4tIrwB/deployer/coverage-retriever.yaml -c /tmp/tmp4tIrwB/deployer/gatekeeper.yaml -c /tmp/tmp4tIrwB/deployer/image-builder.yaml -c /tmp/tmp4tIrwB/deployer/lander.yaml -c /tmp/tmp4tIrwB/deployer/nf-stats-service.yaml -c /tmp/tmp4tIrwB/deployer/ppa-creator.yaml -c /tmp/tmp4tIrwB/deployer/publisher.yaml -c /tmp/tmp4tIrwB/deployer/relations.yaml -c /tmp/tmp4tIrwB/deployer/test-runner.yaml -c /tmp/tmp4tIrwB/deployer/ticket-system.yaml -c /tmp/tmp4tIrwB/deployer/validator.yaml -c /tmp/tmp4tIrwB/deployer/webui.yaml ci-airline
Tests running...
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testConnectFailed ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testProcessQueue ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testRunForever ... OK (0.103 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testSent ... OK (0.004 secs)
ci-utils.ci_utils.tests.test_amqp.TestProgressTrigger.testProgress ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testCancel ... OK (0.106 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testNoQueue ... OK (0.003 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testNoTicket ... OK (0.005 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageCalledProcessError ... OK (0.007 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageFail ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageKilled ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageSimple ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageUnexpected ... OK (0.003 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testSaveLastRun ... OK (0.001 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestTimer.testCBRuns ... OK (0.021 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestTimer.testCanCancel ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreConfig.test_invalid_auth_config ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreConfig.test_valid_auth_config ... OK (0.000 secs)
ci-utils.ci_utils.test...

Revision history for this message
Joe Talbott (joetalbott) wrote :

On Mon, Nov 17, 2014 at 08:21:04PM -0000, Evan Dandrea wrote:
> Evan Dandrea has proposed merging lp:~ev/uci-engine/requires-ready-deployment into lp:uci-engine.
>
> Requested reviews:
> Canonical CI Engineering (canonical-ci-engineering)
>
> For more details, see:
> https://code.launchpad.net/~ev/uci-engine/requires-ready-deployment/+merge/242023
>
> Require a ready deployment before running the integration tests.
>

See my comments in-line. Nothing to halt landing this MP just food for
thought.

[snip]
> +class ReadyDeployment(features.Feature):
> + def _probe(self):

I think it was Ned Batchelder that did a talk where he admonished using
a class with a single method in it and asked "why not just use a
method?"

> + print 'here we go'

I think this can be removed, right?

> + try:
> + out = subprocess.check_output(['juju', 'status'])
> + except subprocess.CalledProcessError:
> + return False

We should probably log something here.

> +
> + status = yaml.safe_load(out)
> + for service, service_data in status['services'].iteritems():
> + for unit, unit_data in service_data['units'].iteritems():
> + agent_state = unit_data['agent-state']
> + if agent_state in ('pending', 'error'):
> + msg = '{} in {} state.'.format(unit, agent_state)
> + print >>sys.stderr, msg

I seem to recall this method of writing to stderr being frowned upon.
For python3 compatibility you can do something like:

  from future import print_function

  print(msg, file=sys.stderr)

[snip]

Unmerged revisions

899. By Evan

Treat all non-started states as an error.

898. By Evan

Remove debugging statement.

897. By Evan

Add a feature requirement of a ready deployment.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ci-utils/ci_utils/testing/features.py'
2--- ci-utils/ci_utils/testing/features.py 2014-10-15 10:35:04 +0000
3+++ ci-utils/ci_utils/testing/features.py 2014-11-17 23:53:11 +0000
4@@ -14,6 +14,7 @@
5 # along with this program. If not, see <http://www.gnu.org/licenses/>.
6 import errno
7 import os
8+import sys
9 import subprocess
10
11 import swiftclient
12@@ -122,6 +123,27 @@
13 nova_creds = NovaCredentials()
14
15
16+class ReadyDeployment(features.Feature):
17+ def _probe(self):
18+ try:
19+ out = subprocess.check_output(['juju', 'status'])
20+ except subprocess.CalledProcessError:
21+ return False
22+
23+ status = yaml.safe_load(out)
24+ for service, service_data in status['services'].iteritems():
25+ for unit, unit_data in service_data['units'].iteritems():
26+ agent_state = unit_data['agent-state']
27+ if agent_state != 'started':
28+ msg = '{} in {} state.'.format(unit, agent_state)
29+ print >>sys.stderr, msg
30+ return False
31+ return True
32+
33+
34+ready_deployment = ReadyDeployment()
35+
36+
37 class BootstrappedJuju(features.Feature):
38
39 def __init__(self):
40
41=== modified file 'tests/deployers.py'
42--- tests/deployers.py 2014-11-06 13:40:54 +0000
43+++ tests/deployers.py 2014-11-17 23:53:11 +0000
44@@ -92,8 +92,7 @@
45 return ip, int(port)
46
47
48-# TODO ev 2014-06-16 @features.requires(features.settled_units)
49-@features.requires(features.bootstrapped_juju)
50+@features.requires(features.ready_deployment)
51 class DeployerTest(testing.TestCaseWithGnupg):
52 '''Base class for building juju deployer based tests.'''
53

Subscribers

People subscribed via source and target branches

to all changes: