diff options
23 files changed, 199 insertions, 16 deletions
diff --git a/moonclient/moonclient/tests.py b/moonclient/moonclient/tests.py index fb4daa69..3bef6b9d 100644 --- a/moonclient/moonclient/tests.py +++ b/moonclient/moonclient/tests.py @@ -23,10 +23,15 @@ class TestsLaunch(Lister): result_vars = dict() logfile_name = "/tmp/moonclient_test_{}.log".format(time.strftime("%Y%m%d-%H%M%S")) logfile = open(logfile_name, "w") + TIME_FORMAT = '%Y-%m-%d %H:%M:%S' def get_parser(self, prog_name): parser = super(TestsLaunch, self).get_parser(prog_name) parser.add_argument( + '--stop-on-error', + help='Stop the test on the first error', + ) + parser.add_argument( 'testfile', metavar='<filename(s)>', help='Filenames that contains tests to run ' @@ -130,7 +135,7 @@ class TestsLaunch(Lister): if port: title += ":" + port title += "\n" - self.logfile.write(title + "\n") + self.logfile.write(time.strftime(self.TIME_FORMAT) + " " + title + "\n") self.log.info(title) data_tmp = list() data_tmp.append("") @@ -149,7 +154,7 @@ class TestsLaunch(Lister): else: continue ext_command = self.__replace_var_in_str(ext_command) - self.logfile.write("-----> {}\n".format(ext_command)) + self.logfile.write(time.strftime(self.TIME_FORMAT) + " " + "-----> {}\n".format(ext_command)) self.log.info(" \\-executing external \"{}\"".format(ext_command)) pipe = subprocess.Popen(shlex.split(ext_command), stdout=subprocess.PIPE, stderr=subprocess.PIPE) com = pipe.communicate() @@ -163,7 +168,7 @@ class TestsLaunch(Lister): else: command = test["command"] + " " + global_command_options command = self.__replace_var_in_str(command) - self.logfile.write("-----> {}\n".format(command)) + self.logfile.write(time.strftime(self.TIME_FORMAT) + " " + "-----> {}\n".format(command)) self.log.info(" \\-executing {}".format(command)) self.app.stdout = tmp_filename_fd result_id = self.app.run_subcommand(shlex.split(command)) diff --git a/moonclient/moonclient/tests/tests_action_assignments.json b/moonclient/moonclient/tests/tests_action_assignments.json index 4ce58335..f5cabbbb 100644 --- a/moonclient/moonclient/tests/tests_action_assignments.json +++ b/moonclient/moonclient/tests/tests_action_assignments.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_action_categories.json b/moonclient/moonclient/tests/tests_action_categories.json index d7485704..1932ffc0 100644 --- a/moonclient/moonclient/tests/tests_action_categories.json +++ b/moonclient/moonclient/tests/tests_action_categories.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_action_scopes.json b/moonclient/moonclient/tests/tests_action_scopes.json index 2dd26c67..069af73e 100644 --- a/moonclient/moonclient/tests/tests_action_scopes.json +++ b/moonclient/moonclient/tests/tests_action_scopes.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_actions.json b/moonclient/moonclient/tests/tests_actions.json index f512a91c..07de9cc0 100644 --- a/moonclient/moonclient/tests/tests_actions.json +++ b/moonclient/moonclient/tests/tests_actions.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_admin_intraextensions.json b/moonclient/moonclient/tests/tests_admin_intraextensions.json index 5d3fa921..16a47348 100644 --- a/moonclient/moonclient/tests/tests_admin_intraextensions.json +++ b/moonclient/moonclient/tests/tests_admin_intraextensions.json @@ -3,6 +3,11 @@ "tests_group": { "main": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_configuration.json b/moonclient/moonclient/tests/tests_configuration.json index 3ad327c8..de16ec9d 100644 --- a/moonclient/moonclient/tests/tests_configuration.json +++ b/moonclient/moonclient/tests/tests_configuration.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_empty_policy_new_user.json b/moonclient/moonclient/tests/tests_empty_policy_new_user.json index 3e03fdff..7c1d08cd 100644 --- a/moonclient/moonclient/tests/tests_empty_policy_new_user.json +++ b/moonclient/moonclient/tests/tests_empty_policy_new_user.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "nova image-list", "external_command": "nova image-list", "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.3.4-x86_64-uec", @@ -3276,6 +3281,62 @@ "description": "Check that the rule was correctly added.", "command_options": "-c id -c s:role -c a:action_id -c o:object_id -f value" }, + { + "name": "add_a_new_rule", + "command": "rule add $submetarule_uuid_admin \"demo_role,read,authz_object_scopes\"", + "result": "^$", + "description": "Add a new rule.", + "command_options": "" + }, + { + "name": "check_added_rule", + "command": "rule list $submetarule_uuid_admin", + "result": "(?P<rule_id>\\w+)\\s+demo_role\\s+read\\s+authz_object_scopes", + "description": "Check that the rule was correctly added.", + "command_options": "-c id -c s:role -c a:action_id -c o:object_id -f value" + }, + { + "name": "add_a_new_rule", + "command": "rule add $submetarule_uuid_admin \"demo_role,write,authz_object_scopes\"", + "result": "^$", + "description": "Add a new rule.", + "command_options": "" + }, + { + "name": "check_added_rule", + "command": "rule list $submetarule_uuid_admin", + "result": "(?P<rule_id>\\w+)\\s+demo_role\\s+write\\s+authz_object_scopes", + "description": "Check that the rule was correctly added.", + "command_options": "-c id -c s:role -c a:action_id -c o:object_id -f value" + }, + { + "name": "add_a_new_rule", + "command": "rule add $submetarule_uuid_admin \"demo_role,read,authz_object_categories\"", + "result": "^$", + "description": "Add a new rule.", + "command_options": "" + }, + { + "name": "check_added_rule", + "command": "rule list $submetarule_uuid_admin", + "result": "(?P<rule_id>\\w+)\\s+demo_role\\s+read\\s+authz_object_categories", + "description": "Check that the rule was correctly added.", + "command_options": "-c id -c s:role -c a:action_id -c o:object_id -f value" + }, + { + "name": "add_a_new_rule", + "command": "rule add $submetarule_uuid_admin \"demo_role,write,authz_object_categories\"", + "result": "^$", + "description": "Add a new rule.", + "command_options": "" + }, + { + "name": "check_added_rule", + "command": "rule list $submetarule_uuid_admin", + "result": "(?P<rule_id>\\w+)\\s+demo_role\\s+write\\s+authz_object_categories", + "description": "Check that the rule was correctly added.", + "command_options": "-c id -c s:role -c a:action_id -c o:object_id -f value" + }, { "name": "select_authz_ie", @@ -3447,6 +3508,11 @@ { + "auth_name": "admin", + "description": "Change user to admin" + }, + + { "name": "delete_authz_intra_extension", "command": "intraextension delete $uuid_authz", "result": "", @@ -3454,6 +3520,13 @@ "command_options": "" }, { + "name": "delete_admin_intra_extension", + "command": "intraextension delete $uuid_admin", + "result": "", + "description": "Delete the admin intra extension", + "command_options": "" + }, + { "name": "delete_tenant", "command": "tenant delete $uuid", "result": "", diff --git a/moonclient/moonclient/tests/tests_empty_policy_nova.json b/moonclient/moonclient/tests/tests_empty_policy_nova.json index 63482212..fdab951f 100644 --- a/moonclient/moonclient/tests/tests_empty_policy_nova.json +++ b/moonclient/moonclient/tests/tests_empty_policy_nova.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "nova image-list", "external_command": "nova image-list", "result": "(?P<uuid_image>[\\w-]+)\\s+\\| cirros-0.3.4-x86_64-uec", @@ -45,6 +50,20 @@ "result": "(?P<uuid>\\w+)\\s+demo", "description": "Check that tenant demo has been correctly added" }, + + { + "name": "check nova command", + "external_command": "nova list", + "no_result": "test_moonclient", + "description": "Check that we cannot list nova servers due to the current rules" + }, + { + "name": "try to pause nova instance", + "external_command": "nova pause $uuid_server", + "result": "^$", + "description": "Pausing the server must be impossible due to the current rules" + }, + { "name": "create_intraextension_authz", "command": "intraextension add --policy_model policy_empty_authz empty_test", @@ -874,19 +893,6 @@ }, { - "name": "check nova command", - "external_command": "nova list", - "no_result": "test_moonclient", - "description": "Check that we cannot list nova servers due to the current rules" - }, - { - "name": "try to pause nova instance", - "external_command": "nova pause $uuid_server", - "result": "^$", - "description": "Pausing the server must be impossible due to the current rules" - }, - - { "name": "list tenant", "command": "tenant list", "result": "demo", diff --git a/moonclient/moonclient/tests/tests_empty_policy_swift.json b/moonclient/moonclient/tests/tests_empty_policy_swift.json index a1c197c4..5ee1833d 100644 --- a/moonclient/moonclient/tests/tests_empty_policy_swift.json +++ b/moonclient/moonclient/tests/tests_empty_policy_swift.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "swift list", "external_command": "swift list", "no_result": "moonclient_test", diff --git a/moonclient/moonclient/tests/tests_external_commands.json b/moonclient/moonclient/tests/tests_external_commands.json index 0b212e93..b01fde26 100644 --- a/moonclient/moonclient/tests/tests_external_commands.json +++ b/moonclient/moonclient/tests/tests_external_commands.json @@ -3,6 +3,11 @@ "tests_group": { "main": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "demo", diff --git a/moonclient/moonclient/tests/tests_object_assignments.json b/moonclient/moonclient/tests/tests_object_assignments.json index fa834cce..3ae555c2 100644 --- a/moonclient/moonclient/tests/tests_object_assignments.json +++ b/moonclient/moonclient/tests/tests_object_assignments.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_object_categories.json b/moonclient/moonclient/tests/tests_object_categories.json index a8a8011a..ac067a89 100644 --- a/moonclient/moonclient/tests/tests_object_categories.json +++ b/moonclient/moonclient/tests/tests_object_categories.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_object_scopes.json b/moonclient/moonclient/tests/tests_object_scopes.json index b97636b6..52ac12fd 100644 --- a/moonclient/moonclient/tests/tests_object_scopes.json +++ b/moonclient/moonclient/tests/tests_object_scopes.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_objects.json b/moonclient/moonclient/tests/tests_objects.json index 10481d33..ef17dd60 100644 --- a/moonclient/moonclient/tests/tests_objects.json +++ b/moonclient/moonclient/tests/tests_objects.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_root_intraextensions.json b/moonclient/moonclient/tests/tests_root_intraextensions.json index 339136d0..e24151d1 100644 --- a/moonclient/moonclient/tests/tests_root_intraextensions.json +++ b/moonclient/moonclient/tests/tests_root_intraextensions.json @@ -2,6 +2,10 @@ "command_options": "-f value", "tests_group": { "main": [ + { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, { "name": "list_intraextension", diff --git a/moonclient/moonclient/tests/tests_rules.json b/moonclient/moonclient/tests/tests_rules.json index 6c220733..1950a1e3 100644 --- a/moonclient/moonclient/tests/tests_rules.json +++ b/moonclient/moonclient/tests/tests_rules.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_subject_assignments.json b/moonclient/moonclient/tests/tests_subject_assignments.json index d038c2c7..e91f1222 100644 --- a/moonclient/moonclient/tests/tests_subject_assignments.json +++ b/moonclient/moonclient/tests/tests_subject_assignments.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_subject_categories.json b/moonclient/moonclient/tests/tests_subject_categories.json index 54540f03..cd2be2d1 100644 --- a/moonclient/moonclient/tests/tests_subject_categories.json +++ b/moonclient/moonclient/tests/tests_subject_categories.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_subject_scopes.json b/moonclient/moonclient/tests/tests_subject_scopes.json index 218038c7..bbf31c11 100644 --- a/moonclient/moonclient/tests/tests_subject_scopes.json +++ b/moonclient/moonclient/tests/tests_subject_scopes.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_subjects.json b/moonclient/moonclient/tests/tests_subjects.json index db79367e..5543372f 100644 --- a/moonclient/moonclient/tests/tests_subjects.json +++ b/moonclient/moonclient/tests/tests_subjects.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_submetarules.json b/moonclient/moonclient/tests/tests_submetarules.json index d8b3e4dd..cde01c27 100644 --- a/moonclient/moonclient/tests/tests_submetarules.json +++ b/moonclient/moonclient/tests/tests_submetarules.json @@ -3,6 +3,11 @@ "tests_group": { "authz": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", diff --git a/moonclient/moonclient/tests/tests_tenants.json b/moonclient/moonclient/tests/tests_tenants.json index c2674db8..719cdbfc 100644 --- a/moonclient/moonclient/tests/tests_tenants.json +++ b/moonclient/moonclient/tests/tests_tenants.json @@ -3,6 +3,11 @@ "tests_group": { "main": [ { + "auth_name": "admin", + "description": "Change user to admin (just in case...)" + }, + + { "name": "list tenant", "command": "tenant list", "no_result": "alt_demo", |