Running tempest.api.network.test_security_group will not cleanup the security groups it created.
To reproduce:
1. Start by counting the number of existing security groups (as an admin):
ubuntu@devstack:/opt/stack/tempest$ source ~/devstack/openrc admin admin password
ubuntu@devstack:/opt/stack/tempest$ neutron security-group-list | wc -l
25
2. Run the test (it execute successfully):
ubuntu@devstack:/opt/stack/tempest$ ./run_tempest.sh tempest.api.network.test_security_groups
tempest.api.network.test_security_groups.SecGroupTest
test_create_security_group_rule_with_additional_args[gate,smoke] OK 0.56
test_create_show_delete_security_group[gate,smoke] OK 0.25
test_create_show_delete_security_group_rule[gate,smoke] OK 0.76
test_list_security_groups[gate,smoke] OK 0.05
tempest.api.network.test_security_groups_negative.NegativeSecGroupTest
test_create_additional_default_security_group_fails[gate,negative,smoke]OK 0.17
test_create_security_group_rule_with_bad_protocol[gate,negative] OK 0.19
test_create_security_group_rule_with_invalid_ports[gate,negative] OK 0.23
test_create_security_group_rule_with_non_existent_security_group[gate,negative,smoke]OK 0.03
test_delete_non_existent_security_group[gate,negative] OK 0.02
test_show_non_existent_security_group[gate,negative] OK 0.01
test_show_non_existent_security_group_rule[gate,negative] OK 0.01
tempest.api.network.test_security_groups_negative.NegativeSecGroupTestXML
test_create_additional_default_security_group_fails[gate,negative,smoke]OK 0.28
test_create_security_group_rule_with_bad_protocol[gate,negative] OK 0.17
test_create_security_group_rule_with_invalid_ports[gate,negative] OK 0.29
test_create_security_group_rule_with_non_existent_security_group[gate,negative,smoke]OK 0.04
test_delete_non_existent_security_group[gate,negative] OK 0.03
test_show_non_existent_security_group[gate,negative] OK 0.01
test_show_non_existent_security_group_rule[gate,negative] OK 0.02
tempest.api.network.test_security_groups.SecGroupTestXML
test_create_security_group_rule_with_additional_args[gate,smoke] OK 0.64
test_create_show_delete_security_group[gate,smoke] OK 0.25
test_create_show_delete_security_group_rule[gate,smoke] OK 0.73
test_list_security_groups[gate,smoke] OK 0.03
Slowest 7 tests took 3.51 secs:
tempest.api.network.test_security_groups.SecGroupTestXML
test_create_security_group_rule_with_additional_args[gate,smoke] 0.64
test_create_show_delete_security_group[gate,smoke] 0.25
test_create_show_delete_security_group_rule[gate,smoke] 0.73
tempest.api.network.test_security_groups.SecGroupTest
test_create_security_group_rule_with_additional_args[gate,smoke] 0.56
test_create_show_delete_security_group_rule[gate,smoke] 0.76
tempest.api.network.test_security_groups_negative.NegativeSecGroupTestXML
test_create_additional_default_security_group_fails[gate,negative,smoke] 0.28
test_create_security_group_rule_with_invalid_ports[gate,negative] 0.29
Ran 22 tests in 6.370s
OK
3. Count the number of secgroups now:
ubuntu@devstack:/opt/stack/tempest$ neutron security-group-list | wc -l
29
For the tests tempest will create new tenant/user. When tempest create an security group for the test, the default security group is also created.
At the end of the tests, secgroups created during the tests are cleaned, but not the default group.