From 27c5a14ef956a604b43050c97b26142b66be31b7 Mon Sep 17 00:00:00 2001 From: Spyros Trigazis Date: Thu, 10 Aug 2017 08:24:42 +0200 Subject: [PATCH] tests: Use swarm-mode for api tests * Swarm-mode is the fastest cluster to deploy since it doesn't require to pull anything from outside. * Add the output nodes for swarm-mode too. * Disable copy logs (I think a better practice is to copy logs on demand). * Don't run test_create_list_sign_delete_clusters, because it is very unstable on the CI. Partially-Implements: blueprint swarm-mode-support 2nd commit message: Update to Fedora Atomic 26 This patch moves the current master to test against Fedora Atomic 26, in addition, it switches to downloading from Fedora mirrors. 2nd-Change-Id: I9a97c0eb78b2c9d10e8be1501babb19e73ee70c1 3rd commit message: Set default iptables FORWARD policy to ACCEPT With the release of Docker 1.13 which is available in Fedora Atomic 26, it no longer sets the policy of the FORWARD chain to ACCEPT[1]. Therefore, CNI networking such as Flannel will cease to work. This patch sets the policy to ACCEPT so that traffic can work once again for deployments which are based on Docker versions which are newer than 1.13 [1]: https://github.com/moby/moby/pull/28257 3rd-Change-Id: I1457602748619f38f87542fc01a2996ee80e58b7 Closes-Bug: #1708454 Co-Authored-By: Mohammed Naser Change-Id: I86d4dcc94fff622be4ee2acc8dd60ed81bc5d433 --- magnum/tests/functional/api/v1/test_bay.py | 2 +- .../tests/functional/api/v1/test_baymodel.py | 2 +- .../functional/api/v1/test_baymodel_admin.py | 2 +- magnum/tests/functional/api/v1/test_cluster.py | 2 +- .../functional/api/v1/test_cluster_template.py | 2 +- .../api/v1/test_cluster_template_admin.py | 2 +- magnum/tests/functional/common/datagen.py | 18 ++++++++++-------- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/magnum/tests/functional/api/v1/test_bay.py b/magnum/tests/functional/api/v1/test_bay.py index c8f5586..77415ac 100755 --- a/magnum/tests/functional/api/v1/test_bay.py +++ b/magnum/tests/functional/api/v1/test_bay.py @@ -58,7 +58,7 @@ class BayTest(base.BaseTempestTest): creds=self.creds, type_of_creds='default', request_type='cert') - model = datagen.valid_swarm_baymodel() + model = datagen.valid_swarm_mode_baymodel() _, self.baymodel = self._create_baymodel(model) # NOTE (dimtruck) by default tempest sets timeout to 20 mins. diff --git a/magnum/tests/functional/api/v1/test_baymodel.py b/magnum/tests/functional/api/v1/test_baymodel.py index c95d38b..0bdce36 100644 --- a/magnum/tests/functional/api/v1/test_baymodel.py +++ b/magnum/tests/functional/api/v1/test_baymodel.py @@ -74,7 +74,7 @@ class BayModelTest(base.BaseTempestTest): @testtools.testcase.attr('positive') def test_create_get_public_baymodel(self): - gen_model = datagen.valid_swarm_baymodel(is_public=True) + gen_model = datagen.valid_swarm_mode_baymodel(is_public=True) self.assertRaises( exceptions.Forbidden, self.baymodel_client.post_baymodel, gen_model) diff --git a/magnum/tests/functional/api/v1/test_baymodel_admin.py b/magnum/tests/functional/api/v1/test_baymodel_admin.py index 9f8642e..67f5b15 100644 --- a/magnum/tests/functional/api/v1/test_baymodel_admin.py +++ b/magnum/tests/functional/api/v1/test_baymodel_admin.py @@ -57,7 +57,7 @@ class BayModelAdminTest(base.BaseTempestTest): @testtools.testcase.attr('positive') def test_create_get_public_baymodel(self): - gen_model = datagen.valid_swarm_baymodel(is_public=True) + gen_model = datagen.valid_swarm_mode_baymodel(is_public=True) resp, model = self._create_baymodel(gen_model) resp, model = self.baymodel_client.get_baymodel(model.uuid) diff --git a/magnum/tests/functional/api/v1/test_cluster.py b/magnum/tests/functional/api/v1/test_cluster.py index fc2a148..59b7004 100755 --- a/magnum/tests/functional/api/v1/test_cluster.py +++ b/magnum/tests/functional/api/v1/test_cluster.py @@ -63,7 +63,7 @@ class ClusterTest(base.BaseTempestTest): creds=self.creds, type_of_creds='default', request_type='cert') - model = datagen.valid_swarm_cluster_template() + model = datagen.valid_swarm_mode_cluster_template() _, self.cluster_template = self._create_cluster_template(model) # NOTE (dimtruck) by default tempest sets timeout to 20 mins. diff --git a/magnum/tests/functional/api/v1/test_cluster_template.py b/magnum/tests/functional/api/v1/test_cluster_template.py index b005373..8713248 100644 --- a/magnum/tests/functional/api/v1/test_cluster_template.py +++ b/magnum/tests/functional/api/v1/test_cluster_template.py @@ -79,7 +79,7 @@ class ClusterTemplateTest(base.BaseTempestTest): @testtools.testcase.attr('positive') def test_create_get_public_cluster_template(self): - gen_model = datagen.valid_swarm_cluster_template(is_public=True) + gen_model = datagen.valid_swarm_mode_cluster_template(is_public=True) self.assertRaises( exceptions.Forbidden, self.cluster_template_client.post_cluster_template, gen_model) diff --git a/magnum/tests/functional/api/v1/test_cluster_template_admin.py b/magnum/tests/functional/api/v1/test_cluster_template_admin.py index 22f4ee9..b8a2e83 100644 --- a/magnum/tests/functional/api/v1/test_cluster_template_admin.py +++ b/magnum/tests/functional/api/v1/test_cluster_template_admin.py @@ -59,7 +59,7 @@ class ClusterTemplateAdminTest(base.BaseTempestTest): @testtools.testcase.attr('positive') def test_create_get_public_cluster_template(self): - gen_model = datagen.valid_swarm_cluster_template(is_public=True) + gen_model = datagen.valid_swarm_mode_cluster_template(is_public=True) resp, model = self._create_cluster_template(gen_model) resp, model = \ diff --git a/magnum/tests/functional/common/datagen.py b/magnum/tests/functional/common/datagen.py index 2fa3fc4..b9a31f2 100644 --- a/magnum/tests/functional/common/datagen.py +++ b/magnum/tests/functional/common/datagen.py @@ -37,6 +37,7 @@ def gen_coe_dep_network_driver(coe): allowed_driver_types = { 'kubernetes': ['flannel', None], 'swarm': ['docker', 'flannel', None], + 'swarm-mode': ['docker', None], 'mesos': ['docker', None], } driver_types = allowed_driver_types[coe] @@ -47,6 +48,7 @@ def gen_coe_dep_volume_driver(coe): allowed_driver_types = { 'kubernetes': ['cinder', None], 'swarm': ['rexray', None], + 'swarm-mode': ['rexray', None], 'mesos': ['rexray', None], } driver_types = allowed_driver_types[coe] @@ -103,7 +105,7 @@ def baymodel_data(**kwargs): data = { "name": data_utils.rand_name('bay'), - "coe": "swarm", + "coe": "swarm-mode", "tls_disabled": False, "network_driver": None, "volume_driver": None, @@ -208,8 +210,8 @@ def baymodel_valid_data_with_specific_coe(coe): image_id=config.Config.image_id, coe=coe) -def valid_swarm_baymodel(is_public=False): - """Generates a valid swarm baymodel with valid data +def valid_swarm_mode_baymodel(is_public=False): + """Generates a valid swarm mode baymodel with valid data :returns: BayModelEntity with generated data """ @@ -218,7 +220,7 @@ def valid_swarm_baymodel(is_public=False): flavor_id=config.Config.flavor_id, public=is_public, dns_nameserver=config.Config.dns_nameserver, master_flavor_id=config.Config.master_flavor_id, - keypair_id=config.Config.keypair_id, coe="swarm", + keypair_id=config.Config.keypair_id, coe="swarm-mode", cluster_distro=None, external_network_id=config.Config.nic_id, http_proxy=None, https_proxy=None, no_proxy=None, @@ -343,7 +345,7 @@ def cluster_template_data(**kwargs): data = { "name": data_utils.rand_name('cluster'), - "coe": "swarm", + "coe": "swarm-mode", "tls_disabled": False, "network_driver": None, "volume_driver": None, @@ -485,8 +487,8 @@ def cluster_template_valid_data_with_specific_coe(coe): image_id=config.Config.image_id, coe=coe) -def valid_swarm_cluster_template(is_public=False): - """Generates a valid swarm cluster_template with valid data +def valid_swarm_mode_cluster_template(is_public=False): + """Generates a valid swarm-mode cluster_template with valid data :returns: ClusterTemplateEntity with generated data """ @@ -496,7 +498,7 @@ def valid_swarm_cluster_template(is_public=False): public=is_public, dns_nameserver=config.Config.dns_nameserver, master_flavor_id=master_flavor_id, - coe="swarm", + coe="swarm-mode", cluster_distro=None, external_network_id=config.Config.nic_id, http_proxy=None, https_proxy=None,