11import pytest
22from settings import TEST_DATA
3- from suite .utils .custom_assertions import assert_event
4- from suite .utils .custom_resources_utils import is_dnsendpoint_present
3+ from suite .utils .custom_assertions import assert_event , assert_event_not_present
4+ from suite .utils .custom_resources_utils import is_dnsendpoint_present , read_custom_resource
55from suite .utils .resources_utils import get_events , patch_namespace_with_label , wait_before_test
66from suite .utils .vs_vsr_resources_utils import patch_virtual_server_from_yaml
77from suite .utils .yaml_utils import get_name_from_yaml , get_namespace_from_yaml
@@ -48,6 +48,21 @@ def test_responses_after_setup(
4848 wait_before_test (1 )
4949 print (f"External DNS not updated, retrying... #{ retry } " )
5050 assert wanted_string in log_contents
51+ print ("\n Step 3: Verify VS status is Valid and no bad config events occurred" )
52+ events = get_events (kube_apis .v1 , virtual_server_setup .namespace )
53+ vs_bad_config_event = "Error creating DNSEndpoint for VirtualServer resource"
54+ assert_event_not_present (vs_bad_config_event , events )
55+ response = read_custom_resource (
56+ kube_apis .custom_objects ,
57+ virtual_server_setup .namespace ,
58+ "virtualservers" ,
59+ virtual_server_setup .vs_name ,
60+ )
61+ assert (
62+ response ["status" ]
63+ and response ["status" ]["reason" ] == "AddedOrUpdated"
64+ and response ["status" ]["state" ] == "Valid"
65+ )
5166
5267 def test_update_to_ed_in_vs (
5368 self , kube_apis , crd_ingress_controller_with_ed , create_externaldns , virtual_server_setup
@@ -65,6 +80,18 @@ def test_update_to_ed_in_vs(
6580 wait_before_test (5 )
6681 events = get_events (kube_apis .v1 , virtual_server_setup .namespace )
6782 assert_event (vs_event_update_text , events )
83+ print ("\n Step 3: Verify VS status is Valid" )
84+ response = read_custom_resource (
85+ kube_apis .custom_objects ,
86+ virtual_server_setup .namespace ,
87+ "virtualservers" ,
88+ virtual_server_setup .vs_name ,
89+ )
90+ assert (
91+ response ["status" ]
92+ and response ["status" ]["reason" ] == "AddedOrUpdated"
93+ and response ["status" ]["state" ] == "Valid"
94+ )
6895
6996
7097@pytest .mark .vs
@@ -122,3 +149,18 @@ def test_responses_after_setup(
122149 wait_before_test (1 )
123150 print (f"External DNS not updated, retrying... #{ retry } " )
124151 assert wanted_string in log_contents
152+ print ("\n Step 3: Verify VS status is Valid and no bad config events occurred" )
153+ events = get_events (kube_apis .v1 , virtual_server_setup .namespace )
154+ vs_bad_config_event = "Error creating DNSEndpoint for VirtualServer resource"
155+ assert_event_not_present (vs_bad_config_event , events )
156+ response = read_custom_resource (
157+ kube_apis .custom_objects ,
158+ virtual_server_setup .namespace ,
159+ "virtualservers" ,
160+ virtual_server_setup .vs_name ,
161+ )
162+ assert (
163+ response ["status" ]
164+ and response ["status" ]["reason" ] == "AddedOrUpdated"
165+ and response ["status" ]["state" ] == "Valid"
166+ )
0 commit comments