1
1
import pytest
2
+
2
3
from settings import TEST_DATA
3
- from suite .fixtures import PublicEndpoint
4
4
from suite .resources_utils import (
5
5
create_example_app ,
6
6
create_items_from_yaml ,
15
15
wait_before_test ,
16
16
wait_until_all_pods_are_ready ,
17
17
)
18
- from suite .yaml_utils import get_first_ingress_host_from_yaml , get_name_from_yaml
19
-
20
- paths = ["backend1" , "backend2" ]
18
+ from suite .yaml_utils import get_name_from_yaml
21
19
22
20
23
- class DisableIPV6Setup :
21
+ class IngressSetup :
24
22
"""
25
23
Encapsulate the Disable IPV6 Example details.
26
24
27
25
Attributes:
28
- public_endpoint (PublicEndpoint):
29
26
ingress_name (str):
30
- ingress_host (str):
31
27
ingress_pod_name (str):
32
28
namespace (str):
33
29
"""
34
30
35
- def __init__ (self , public_endpoint : PublicEndpoint , ingress_name , ingress_host , ingress_pod_name , namespace ):
36
- self .public_endpoint = public_endpoint
37
- self .ingress_host = ingress_host
31
+ def __init__ (self , ingress_name , ingress_pod_name , namespace ):
38
32
self .ingress_name = ingress_name
39
33
self .ingress_pod_name = ingress_pod_name
40
34
self .namespace = namespace
41
35
42
36
43
- @pytest .fixture (scope = "class" , params = [ "standard" , "mergeable" ] )
44
- def disable_ipv6_setup (
45
- request ,
46
- kube_apis ,
47
- ingress_controller_prerequisites ,
48
- ingress_controller_endpoint ,
49
- ingress_controller ,
50
- test_namespace ,
51
- ) -> DisableIPV6Setup :
37
+ @pytest .fixture (scope = "class" )
38
+ def ingress_setup (
39
+ request ,
40
+ kube_apis ,
41
+ ingress_controller_prerequisites ,
42
+ ingress_controller_endpoint ,
43
+ ingress_controller ,
44
+ test_namespace ,
45
+ ) -> IngressSetup :
52
46
print
6D38
span>("------------------------- Deploy Disable IPV6 Example -----------------------------------" )
53
- secret_name = create_secret_from_yaml (
54
- kube_apis .v1 , test_namespace , f"{ TEST_DATA } /disable-ipv6-ingress/disable-ipv6-secret.yaml"
55
- )
56
-
57
- create_items_from_yaml (
58
- kube_apis , f"{ TEST_DATA } /disable-ipv6-ingress/{ request .param } /disable-ipv6-ingress.yaml" , test_namespace
59
- )
60
- ingress_name = get_name_from_yaml (f"{ TEST_DATA } /disable-ipv6-ingress/{ request .param } /disable-ipv6-ingress.yaml" )
61
- ingress_host = get_first_ingress_host_from_yaml (
62
- f"{ TEST_DATA } /disable-ipv6-ingress/{ request .param } /disable-ipv6-ingress.yaml"
63
- )
47
+ secret_name = create_secret_from_yaml (kube_apis .v1 , test_namespace , f"{ TEST_DATA } /smoke/smoke-secret.yaml" )
48
+ create_items_from_yaml (kube_apis , f"{ TEST_DATA } /smoke/standard/smoke-ingress.yaml" , test_namespace )
49
+ ingress_name = get_name_from_yaml (f"{ TEST_DATA } /smoke/standard/smoke-ingress.yaml" )
64
50
create_example_app (kube_apis , "simple" , test_namespace )
65
51
wait_until_all_pods_are_ready (kube_apis .v1 , test_namespace )
66
52
@@ -74,38 +60,38 @@ def disable_ipv6_setup(
74
60
def fin ():
75
61
print ("Clean up the Disable IPV6 Application:" )
76
62
delete_common_app (kube_apis , "simple" , test_namespace )
77
- delete_items_from_yaml (
78
- kube_apis , f"{ TEST_DATA } /disable-ipv6-ingress/{ request .param } /disable-ipv6-ingress.yaml" , test_namespace
79
- )
63
+ delete_items_from_yaml (kube_apis , f"{ TEST_DATA } /smoke/standard/smoke-ingress.yaml" , test_namespace )
80
64
delete_secret (kube_apis .v1 , secret_name , test_namespace )
81
65
82
66
request .addfinalizer (fin )
83
67
84
- return DisableIPV6Setup ( ingress_controller_endpoint , ingress_name , ingress_host , ic_pod_name , test_namespace )
68
+ return IngressSetup ( ingress_name , ic_pod_name , test_namespace )
85
69
86
70
87
71
@pytest .mark .ingresses
88
72
class TestDisableIPV6 :
89
73
@pytest .mark .parametrize (
90
74
"ingress_controller" ,
91
75
[
92
- pytest .param ({"extra_args" : ["-disable-ipv6" ]}, id = "one-additional-cli-args" ),
76
+ pytest .param ({"extra_args" : ["-disable-ipv6" ]}),
93
77
],
94
78
indirect = True ,
95
79
)
96
80
def test_ipv6_listeners_not_in_config (
97
- self ,
98
- kube_apis ,
99
- disable_ipv6_setup : DisableIPV6Setup ,
100
- ingress_controller_prerequisites ,
81
+ self ,
82
+ kube_apis ,
83
+ ingress_setup : IngressSetup ,
84
+ ingress_controller_prerequisites ,
101
85
):
102
86
wait_before_test ()
103
- nginx_config = get_nginx_template_conf (kube_apis .v1 , ingress_controller_prerequisites .namespace )
87
+ nginx_config = get_nginx_template_conf (
88
+ kube_apis .v1 , ingress_controller_prerequisites .namespace , ingress_setup .ingress_pod_name
89
+ )
104
90
upstream_conf = get_ingress_nginx_template_conf (
105
91
kube_apis .v1 ,
106
- disable_ipv6_setup .namespace ,
107
- disable_ipv6_setup .ingress_name ,
108
- disable_ipv6_setup .ingress_pod_name ,
92
+ ingress_setup .namespace ,
93
+ ingress_setup .ingress_name ,
94
+ ingress_setup .ingress_pod_name ,
109
95
ingress_controller_prerequisites .namespace ,
110
96
)
111
97
assert "listen [::]:" not in nginx_config
0 commit comments