Fix keypairs clean up in magnum tests

Change-Id: Ia74938865d6d86472194d7c5b50188f9163c6fdf
This commit is contained in:
Luis Pigueiras 2018-07-20 12:01:00 +02:00 committed by Andrey Kurilin
parent 1ee6ec5d9c
commit 6687a26209
3 changed files with 13 additions and 8 deletions

View File

@ -16,6 +16,16 @@ Changelog
.. Release notes for existing releases are MUTABLE! If there is something that .. Release notes for existing releases are MUTABLE! If there is something that
was missed or can be improved, feel free to change it! was missed or can be improved, feel free to change it!
[unreleased] - 2018-07-20
-------------------------
Fixed
~~~~~
* Keypairs are now properly cleaned up after the execution of Magnum
tests.
[1.2.0] - 2018-06-25 [1.2.0] - 2018-06-25
-------------------- --------------------

View File

@ -51,6 +51,7 @@ class ClusterGenerator(context.Context):
nova_scenario = nova_utils.NovaScenario({ nova_scenario = nova_utils.NovaScenario({
"user": user, "user": user,
"task": self.context["task"], "task": self.context["task"],
"owner_id": self.context["owner_id"],
"config": {"api_versions": self.context["config"].get( "config": {"api_versions": self.context["config"].get(
"api_versions", [])} "api_versions", [])}
}) })

View File

@ -53,7 +53,7 @@ class ListClusters(utils.MagnumScenario):
context={"cleanup@openstack": ["magnum.clusters", "nova.keypairs"]}, context={"cleanup@openstack": ["magnum.clusters", "nova.keypairs"]},
name="MagnumClusters.create_and_list_clusters", name="MagnumClusters.create_and_list_clusters",
platform="openstack") platform="openstack")
class CreateAndListClusters(utils.MagnumScenario): class CreateAndListClusters(utils.MagnumScenario, nova_utils.NovaScenario):
def run(self, node_count, **kwargs): def run(self, node_count, **kwargs):
"""create cluster and then list all clusters. """create cluster and then list all clusters.
@ -69,13 +69,7 @@ class CreateAndListClusters(utils.MagnumScenario):
else: else:
del kwargs["cluster_template_uuid"] del kwargs["cluster_template_uuid"]
nova_scenario = nova_utils.NovaScenario({ keypair = self._create_keypair()
"user": self.context["user"],
"task": self.context["task"],
"config": {"api_versions": self.context["config"].get(
"api_versions", [])}
})
keypair = nova_scenario._create_keypair()
new_cluster = self._create_cluster(cluster_template_uuid, node_count, new_cluster = self._create_cluster(cluster_template_uuid, node_count,
keypair=keypair, **kwargs) keypair=keypair, **kwargs)