diff options
author | Thomas Duval <thomas.duval@orange.com> | 2016-09-01 18:26:54 +0200 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2016-09-20 10:38:37 +0200 |
commit | 1dcfe5a30a080297a3f31ec9dc38e19ba741107f (patch) | |
tree | 1c20006435bb635973542eccf051065beca8735b /moonclient | |
parent | 39f679000aa78c784edd1aa1fe64b6a3abbc7d29 (diff) |
Fix errors with Functest.
Change-Id: Iff86047633b89c5a27d56f91e78cdf1377038f5f
(cherry picked from commit 9899dca1f0a2b8b6e9c5dfa96c9288dd64535d1a)
Diffstat (limited to 'moonclient')
5 files changed, 61 insertions, 21 deletions
diff --git a/moonclient/moonclient/tests.py b/moonclient/moonclient/tests.py index de93dc6f..7da7d5ec 100644 --- a/moonclient/moonclient/tests.py +++ b/moonclient/moonclient/tests.py @@ -129,10 +129,13 @@ class TestsLaunch(Lister): description = "" if "auth_name" in test: username = test["auth_name"] + os.environ["OS_USERNAME"] = test["auth_name"] if "auth_password" in test: password = test["auth_password"] + os.environ["OS_PASSWORD"] = test["auth_password"] if "auth_tenant" in test: tenant = test["auth_tenant"] + os.environ["OS_TENANT_NAME"] = test["auth_tenant"] if "auth_host" in test: host = test["auth_host"] if "auth_port" in test: @@ -158,7 +161,7 @@ class TestsLaunch(Lister): data.append(data_tmp) continue data_tmp = list() - tmp_filename = os.path.join("/tmp", uuid4().hex) + tmp_filename = os.path.join("/tmp", "moon_{}.tmp".format(uuid4().hex)) tmp_filename_fd = open(tmp_filename, "w") self.log.debug("test={}".format(test)) if "command" not in test: @@ -189,6 +192,7 @@ class TestsLaunch(Lister): self.app.stdout = stdout_back result_str = open(tmp_filename, "r").read() self.logfile.write("{}".format(result_str)) + os.unlink(tmp_filename) data_tmp.append(group_name) data_tmp.append(test["name"]) if "result" in test: diff --git a/moonclient/moonclient/tests/tests_empty_policy_new_user.json b/moonclient/moonclient/tests/tests_empty_policy_new_user.json index 6d29f4a8..96fb37d9 100644 --- a/moonclient/moonclient/tests/tests_empty_policy_new_user.json +++ b/moonclient/moonclient/tests/tests_empty_policy_new_user.json @@ -10,15 +10,27 @@ }, { + "name": "get cirros image", + "external_command": "wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img -o /tmp/cirros.img", + "result": "", + "description": "Download a Cirros image" + }, + { + "name": "install cirros image", + "external_command": "glance image-create --name \"cirros\" --disk-format qcow2 --file /tmp/cirros.img --container-format bare", + "result": "", + "description": "Upload the Cirros image in glance" + }, + { "name": "nova image-list", "external_command": "nova image-list", - "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.3", + "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros", "description": "Get an Image ID" }, { - "name": "create teannt test", + "name": "create tenant test", "external_command": "openstack project create test_moonclient", - "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.3", + "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros", "description": "Get an Image ID" }, { @@ -30,7 +42,7 @@ { "name": "neutron net-list", "external_command": "neutron net-list", - "result": "(?P<uuid_net>[\\w-]+)\\s+\\| public", + "result": "(?P<uuid_net>[\\w-]+)\\s+\\| ext-net", "description": "Get an Net ID" }, { diff --git a/moonclient/moonclient/tests/tests_empty_policy_nova.json b/moonclient/moonclient/tests/tests_empty_policy_nova.json index e1781c1f..de266d31 100644 --- a/moonclient/moonclient/tests/tests_empty_policy_nova.json +++ b/moonclient/moonclient/tests/tests_empty_policy_nova.json @@ -8,21 +8,33 @@ }, { + "name": "get cirros image", + "external_command": "wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img -o /tmp/cirros.img", + "result": "", + "description": "Download a Cirros image" + }, + { + "name": "install cirros image", + "external_command": "glance image-create --name \"cirros\" --disk-format qcow2 --file /tmp/cirros.img --container-format bare", + "result": "", + "description": "Upload the Cirros image in glance" + }, + { "name": "nova image-list", "external_command": "nova image-list", - "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.*", + "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros", "description": "Get an Image ID" }, { "name": "neutron net-list", "external_command": "neutron net-list", - "result": "(?P<uuid_net>[\\w-]+)\\s+\\| public", + "result": "(?P<uuid_net>[\\w-]+)\\s+\\| ext-net", "description": "Get an Net ID" }, { "name": "nova boot new server", "external_command": "nova boot --flavor m1.tiny --image $uuid_image --nic net-id=$uuid_net test_moonclient", - "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.", + "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros", "description": "Get an Image ID" }, { diff --git a/moonclient/moonclient/tests/tests_empty_policy_swift.json b/moonclient/moonclient/tests/tests_empty_policy_swift.json index 4c9e1315..93b39d6e 100644 --- a/moonclient/moonclient/tests/tests_empty_policy_swift.json +++ b/moonclient/moonclient/tests/tests_empty_policy_swift.json @@ -35,20 +35,20 @@ { "name": "list tenant", "command": "tenant list", - "no_result": "demo", + "no_result": "admin", "description": "Check if tenant demo is used." }, { - "name": "add tenant demo", - "command": "tenant add demo", + "name": "add tenant admin", + "command": "tenant add admin", "result": "^$", "description": "Add a new tenant", "command_options": "" }, { - "name": "check tenant demo", + "name": "check tenant admin", "command": "tenant list", - "result": "(?P<uuid>\\w+)\\s+demo", + "result": "(?P<uuid>\\w+)\\s+admin", "description": "Check that tenant demo has been correctly added" }, { @@ -74,8 +74,8 @@ { "name": "list tenant", "command": "tenant list", - "result": "demo", - "description": "Check if tenant demo is used." + "result": "admin", + "description": "Check if tenant admin is used." }, { "name": "select_authz_ie", @@ -889,8 +889,8 @@ { "name": "list tenant", "command": "tenant list", - "result": "demo", - "description": "Check if tenant demo is used." + "result": "admin", + "description": "Check if tenant admin is used." }, { @@ -1159,7 +1159,7 @@ "name": "delete_tenant", "command": "tenant delete $uuid", "result": "", - "description": "Delete the tenant demo", + "description": "Delete the tenant admin", "command_options": "" }, { diff --git a/moonclient/moonclient/tests/tests_external_commands.json b/moonclient/moonclient/tests/tests_external_commands.json index d94658cc..25993dd0 100644 --- a/moonclient/moonclient/tests/tests_external_commands.json +++ b/moonclient/moonclient/tests/tests_external_commands.json @@ -118,21 +118,33 @@ }, { + "name": "get cirros image", + "external_command": "wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img -o /tmp/cirros.img", + "result": "", + "description": "Download a Cirros image" + }, + { + "name": "install cirros image", + "external_command": "glance image-create --name \"cirros\" --disk-format qcow2 --file /tmp/cirros.img --container-format bare", + "result": "", + "description": "Upload the Cirros image in glance" + }, + { "name": "nova image-list", "external_command": "nova image-list", - "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.", + "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros", "description": "Get an Image ID" }, { "name": "neutron net-list", "external_command": "neutron net-list", - "result": "(?P<uuid_net>[\\w-]+)\\s+\\| public", + "result": "(?P<uuid_net>[\\w-]+)\\s+\\| ext-net", "description": "Get an Net ID" }, { "name": "nova boot new server", "external_command": "nova boot --flavor m1.tiny --image $uuid_image --nic net-id=$uuid_net test_moonclient", - "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.", + "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros", "description": "Get an Image ID" }, { |