Merge lp:~veebers/juju-ci-tools/model-migration-part3-version-test into lp:juju-ci-tools

Proposed by Christopher Lee
Status: Work in progress
Proposed branch: lp:~veebers/juju-ci-tools/model-migration-part3-version-test
Merge into: lp:juju-ci-tools
Prerequisite: lp:~veebers/juju-ci-tools/initial-addition-of-model-migration-part2
Diff against target: 103 lines (+52/-3)
2 files modified
assess_model_migration.py (+51/-2)
jujupy.py (+1/-1)
To merge this branch: bzr merge lp:~veebers/juju-ci-tools/model-migration-part3-version-test
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Needs Information
Review via email: mp+296171@code.launchpad.net

Commit message

Introduce model migration test for controllers of differing versions.

Description of the change

Introduce model migration test for controllers of differing versions.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you Chris. I see several calls in these changes that appear to duplicate existing functions. I am concerned that this branch assumes machine 0 is the only controller.

review: Needs Information (code)
Revision history for this message
Aaron Bentley (abentley) wrote :

A few more comments inline.

1435. By Christopher Lee

Merged model-migration-part2 into model-migration-part3-version-test.

1436. By Christopher Lee

Merge trunk w/ conflict fixes.

1437. By Christopher Lee

Merge trunk w/ conflicts resolved.

1438. By Christopher Lee

Make changes as per MP review

1439. By Christopher Lee

Merged model-migration-part2 into model-migration-part3-version-test.

1440. By Christopher Lee

Merged model-migration-part2 into model-migration-part3-version-test.

1441. By Christopher Lee

Merged model-migration-part2 into model-migration-part3-version-test.

1442. By Christopher Lee

Merge trunk

1443. By Christopher Lee

Merged model-migration-part2 into model-migration-part3-version-test.

1444. By Christopher Lee

Merged update-fix-model-migration-test into model-migration-part3-version-test.

1445. By Christopher Lee

Merged add-test-feature-units-and-remigration into model-migration-part3-version-test.

1446. By Christopher Lee

Merge trunk

1447. By Christopher Lee

Attempt controller upgrade.

1448. By Christopher Lee

Don't force version

1449. By Christopher Lee

Merge trunk changes

1450. By Christopher Lee

Update upgrade controller to not use upload-tools

Unmerged revisions

1450. By Christopher Lee

Update upgrade controller to not use upload-tools

1449. By Christopher Lee

Merge trunk changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'assess_model_migration.py'
2--- assess_model_migration.py 2016-08-01 05:57:55 +0000
3+++ assess_model_migration.py 2016-08-18 03:40:10 +0000
4@@ -10,7 +10,10 @@
5 import sys
6 from time import sleep
7
8-from deploy_stack import BootstrapManager
9+from deploy_stack import (
10+ BootstrapManager,
11+ assess_upgrade,
12+)
13 from utility import (
14 JujuAssertionError,
15 add_basic_testing_arguments,
16@@ -26,7 +29,8 @@
17
18
19 def assess_model_migration(bs1, bs2, upload_tools):
20- ensure_able_to_migrate_model_between_controllers(bs1, bs2, upload_tools)
21+ # ensure_able_to_migrate_model_between_controllers(bs1, bs2, upload_tools)
22+ ensure_fail_to_migrate_to_lower_version_controller(bs1, bs2, upload_tools)
23
24
25 def parse_args(argv):
26@@ -48,6 +52,9 @@
27 bs_1 = BootstrapManager.from_args(args)
28 bs_2 = BootstrapManager.from_args(args)
29
30+ # Need to be able to upgrade this controller.
31+ bs_1.client.env.config['enable-os-upgrade'] = True
32+
33 # Give the second a separate/unique name.
34 bs_2.temp_env_name = '{}-b'.format(bs_1.temp_env_name)
35
36@@ -83,6 +90,19 @@
37 ))
38
39
40+def _update_client_controller(client):
41+ log.info('Updating clients ({}) controller'.format(
42+ client.env.environment))
43+
44+ admin_client = client.get_controller_client()
45+ admin_client.env.local = True
46+ admin_client.upgrade_controller(force_version=False)
47+ admin_client.wait_for_version(
48+ admin_client.get_matching_agent_version(), 600)
49+ # assess_upgrade(admin_client, admin_client.full_path)
50+ # After upgrade, is there an exception perhaps?
51+
52+
53 def test_deployed_mongo_is_up(client):
54 """Ensure the mongo service is running as expected."""
55 try:
56@@ -196,6 +216,35 @@
57 raise JujuAssertionError('Appliction units reside on the same machine')
58
59
60+def ensure_fail_to_migrate_to_lower_version_controller(bs1, bs2, upload_tools):
61+ """
62+ Migration must not proceed if the target controller version is less than
63+ the source controller.
64+
65+ """
66+ with bs1.booted_context(upload_tools):
67+ bs1.client.enable_feature('migration')
68+
69+ _update_client_controller(bs1.client)
70+
71+ log.info('Booting second instance')
72+ bs2.client.env.juju_home = bs1.client.env.juju_home
73+ with bs2.existing_booted_context(upload_tools):
74+ log.info('Initiating migration process')
75+ try:
76+ bs1.client.controller_juju(
77+ 'migrate',
78+ (bs1.client.env.environment,
79+ 'local.{}'.format(bs2.client.env.controller.name)))
80+ except CalledProcessError as e:
81+ if 'expected error message' in e:
82+ return True
83+ # If the migration didn't fail there is an issue and we need to
84+ # fail
85+ raise RuntimeError(
86+ 'Migrating to upgraded controller did not error.')
87+
88+
89 def main(argv=None):
90 args = parse_args(argv)
91 configure_logging(args.verbose)
92
93=== modified file 'jujupy.py'
94--- jujupy.py 2016-08-17 20:53:38 +0000
95+++ jujupy.py 2016-08-18 03:40:10 +0000
96@@ -1700,7 +1700,7 @@
97 version = self.get_matching_agent_version(no_build=True)
98 args += ('--version', version)
99 if self.env.local:
100- args += ('--upload-tools',)
101+ args += ('--build-agent',)
102
103 self._upgrade_controller(args)
104

Subscribers

People subscribed via source and target branches