@@ -11,10 +11,8 @@ package runner
11
11
import (
12
12
"context"
13
13
"fmt"
14
- "strings"
15
14
"time"
16
15
17
- "github.com/Azure/go-autorest/autorest/to"
18
16
. "github.com/onsi/ginkgo"
19
17
. "github.com/onsi/gomega"
20
18
@@ -43,33 +41,8 @@ var _ = Describe("networking-v1-LFU", func() {
43
41
cleanUp (clientset )
44
42
})
45
43
46
- It ("[prohibited-target-test] prohibited service should be available to be accessed" , func () {
47
- // get ip address for 1 ingress
48
- klog .Info ("Getting public IP from blacklisted Ingress..." )
49
- publicIP , _ := getPublicIP (clientset , "test-brownfield-ns" )
50
- Expect (publicIP ).ToNot (Equal ("" ))
51
-
52
- //prohibited service will be kept by agic
53
- url_blacklist := fmt .Sprintf ("http://%s/blacklist" , publicIP )
54
- _ , err = makeGetRequest (url_blacklist , "brownfield-blacklist-ns.host" , 200 , true )
55
- Expect (err ).To (BeNil ())
56
-
57
- //delete namespaces for blacklist testing
58
- deleteOptions := metav1.DeleteOptions {
59
- GracePeriodSeconds : to .Int64Ptr (0 ),
60
- }
61
-
62
- klog .Info ("Delete namespaces test-brownfield-ns after blacklist testing..." )
63
- err = clientset .CoreV1 ().Namespaces ().Delete (context .TODO (), "test-brownfield-ns" , deleteOptions )
64
- Expect (err ).To (BeNil ())
65
- })
66
-
67
- It ("[sub-resource-prefix] should be use the sub-resource-prefix to prefix sub-resources" , func () {
68
- env := GetEnv ()
69
- klog .Infof ("'subResourceNamePrefix': %s" , env .SubResourceNamePrefix )
70
- Expect (env .SubResourceNamePrefix ).ToNot (Equal ("" ), "Please make sure that environment variable 'subResourceNamePrefix' is set" )
71
-
72
- namespaceName := "e2e-sub-resource-prefix"
44
+ It ("[prohibited-target-test] prohibited target should be available to be accessed" , func () {
45
+ namespaceName := "e2e-prohibited-target"
73
46
ns := & v1.Namespace {
74
47
ObjectMeta : metav1.ObjectMeta {
75
48
Name : namespaceName ,
@@ -79,26 +52,38 @@ var _ = Describe("networking-v1-LFU", func() {
79
52
_ , err = clientset .CoreV1 ().Namespaces ().Create (context .TODO (), ns , metav1.CreateOptions {})
80
53
Expect (err ).To (BeNil ())
81
54
82
- SSLE2ERedirectYamlPath := "testdata/networking-v1/one-namespace-one-ingress/ssl-e2e-redirect /app.yaml"
83
- klog .Info ("Applying yaml: " , SSLE2ERedirectYamlPath )
84
- err = applyYaml (clientset , crdClient , namespaceName , SSLE2ERedirectYamlPath )
55
+ appYamlPath := "testdata/networking-v1/one-namespace-one-ingress/prohibited-target /app.yaml"
56
+ klog .Info ("Applying yaml: " , appYamlPath )
57
+ err = applyYaml (clientset , crdClient , namespaceName , appYamlPath )
85
58
Expect (err ).To (BeNil ())
86
59
time .Sleep (30 * time .Second )
87
60
88
- gateway , err := getGateway ()
61
+ // get ip address for 1 ingress
62
+ klog .Info ("Getting public IP of the app gateway" )
63
+ ip , err := getPublicIPAddress ()
64
+ Expect (err ).To (BeNil ())
65
+
66
+ publicIP := * ip .IPAddress
67
+ klog .Infof ("Public IP: %s" , publicIP )
68
+
69
+ protectedPath := fmt .Sprintf ("http://%s/landing/" , publicIP )
70
+ _ , err = makeGetRequest (protectedPath , "www.microsoft.com" , 302 , true )
89
71
Expect (err ).To (BeNil ())
90
72
91
- prefixUsed := false
92
- for _ , listener := range * gateway .HTTPListeners {
93
- klog .Infof ("checking listener %s for %s" , * listener .Name , env .SubResourceNamePrefix )
94
- if strings .HasPrefix (* listener .Name , env .SubResourceNamePrefix ) {
95
- klog .Infof ("found %s that uses the prefix" , * listener .Name )
96
- prefixUsed = true
97
- break
98
- }
99
- }
73
+ ingressPath := fmt .Sprintf ("http://%s/aspnet" , publicIP )
74
+ _ , err = makeGetRequest (ingressPath , "www.microsoft.com" , 200 , true )
75
+ Expect (err ).To (BeNil ())
100
76
101
- Expect (prefixUsed ).To (BeTrue (), "%s wasn't used for naming the sub-resource of app gateway. Currently, this check looks at HTTP listener only" , env .SubResourceNamePrefix )
77
+ klog .Info ("Deleting yaml: " , appYamlPath )
78
+ err = deleteYaml (clientset , crdClient , namespaceName , appYamlPath )
79
+ Expect (err ).To (BeNil ())
80
+ time .Sleep (30 * time .Second )
81
+
82
+ _ , err = makeGetRequest (protectedPath , "www.microsoft.com" , 302 , true )
83
+ Expect (err ).To (BeNil ())
84
+
85
+ _ , err = makeGetRequest (ingressPath , "www.microsoft.com" , 502 , true )
86
+ Expect (err ).To (BeNil ())
102
87
})
103
88
104
89
AfterEach (func () {
0 commit comments