From 31c45b33dccdba5b3790281d6da055be73bb15f2 Mon Sep 17 00:00:00 2001 From: zhiyuan_cai Date: Fri, 16 Jun 2017 17:06:03 +0800 Subject: [PATCH] [Urgent] Fix sec-group unit tests and smoke tests 1. What is the problem (1) In this patch[1] of Neutron project, new object model for security group is used. As a result, the "remote_ip_prefix" field returned by "get_security_group_rule" is an AuthenticIPNetwork object instead of a string, so our "_compare_rule" method fails to recognize two identical rules. (2) After this patch[2] of devstack-gate project, horizon is no longer the default project to be deployed in gate test, so enable horizon in our own local.conf without explicitly enabling horizon in the gate test will cause gate test to fail. 2. What is the solution for the problem (1) Use str() to transform the AuthenticIPNetwork object to string. (2) Disable horizon in our own local.conf since we don't need it. 3. What features need to be implemented to the Tricircle to realize the solution N/A [1] https://github.com/openstack/neutron/commit/ af52d499a53f9dddacd8c9116d1bb0570e8f579c [2] https://github.com/openstack-infra/devstack-gate/commit/ e1b6e9f1d6532fe87a8947a633e254d14aeb8fc0 Change-Id: I57ac130cb2383f2912fc6c0af646fb84ab2cdd90 --- tricircle/network/security_groups.py | 2 +- tricircle/tempestplugin/gate_hook.sh | 2 +- tricircle/tests/unit/network/test_security_groups.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tricircle/network/security_groups.py b/tricircle/network/security_groups.py index e0a9e025..27a5ac5e 100644 --- a/tricircle/network/security_groups.py +++ b/tricircle/network/security_groups.py @@ -42,7 +42,7 @@ class TricircleSecurityGroupMixin(securitygroups_db.SecurityGroupDbMixin): def _compare_rule(rule1, rule2): for key in ('direction', 'remote_ip_prefix', 'protocol', 'ethertype', 'port_range_max', 'port_range_min'): - if rule1[key] != rule2[key]: + if rule1[key] != rule2[key] and str(rule1[key]) != str(rule2[key]): return False return True diff --git a/tricircle/tempestplugin/gate_hook.sh b/tricircle/tempestplugin/gate_hook.sh index 89e3678b..5e78e18e 100755 --- a/tricircle/tempestplugin/gate_hook.sh +++ b/tricircle/tempestplugin/gate_hook.sh @@ -30,7 +30,7 @@ function _setup_tricircle_multinode { SUBNODE_IP=$(head -n1 /etc/nodepool/sub_nodes_private) export OVERRIDE_ENABLED_SERVICES="c-api,c-bak,c-sch,c-vol,cinder," - export OVERRIDE_ENABLED_SERVICES+="g-api,g-reg,horizon,key," + export OVERRIDE_ENABLED_SERVICES+="g-api,g-reg,key," export OVERRIDE_ENABLED_SERVICES+="n-api,n-cauth,n-cond,n-cpu,n-crt," export OVERRIDE_ENABLED_SERVICES+="n-novnc,n-obj,n-sch," export OVERRIDE_ENABLED_SERVICES+="placement-api,placement-client," diff --git a/tricircle/tests/unit/network/test_security_groups.py b/tricircle/tests/unit/network/test_security_groups.py index 398a39c8..e7e5bad2 100644 --- a/tricircle/tests/unit/network/test_security_groups.py +++ b/tricircle/tests/unit/network/test_security_groups.py @@ -28,6 +28,7 @@ class TricircleSecurityGroupTestMixin(object): return {'security_group_id': sg_id, 'id': _id, 'tenant_id': project_id, + 'project_id': project_id, 'remote_group_id': remote_group, 'direction': 'ingress', 'remote_ip_prefix': ip_prefix,