Skip to content

Commit 32ea314

Browse files
authored
e2e: test brownfield setup (#882)
* e2e: test prohibited target add one blacklisted service and one whitelisted service * delete agic without shared from agic namespace * fix yaml indent, rename testing namespace for brownfield * update testing namespace in test case * correct the namespace created for testing blacklist * delete agic if it exists * fix brownfield bootstrap test * wait until appgw config for brownfield rule got applied
1 parent fece0e3 commit 32ea314

File tree

9 files changed

+1146
-1900
lines changed

9 files changed

+1146
-1900
lines changed

scripts/e2e/cmd/runner/helper.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ func cleanUp(clientset *kubernetes.Clientset) error {
316316
break
317317
}
318318

319-
klog.Warning("Trying again...", i)
320-
time.Sleep(time.Second)
319+
klog.Warning("cleanUp: trying again...", i)
320+
time.Sleep(5 * time.Second)
321321
}
322322
}
323323

@@ -347,7 +347,7 @@ func getPublicIP(clientset *kubernetes.Clientset, namespaceName string) (string,
347347
return publicIP, nil
348348
}
349349

350-
klog.Warning("Trying again in 5 seconds...", i)
350+
klog.Warning("getPublicIP: trying again in 5 seconds...", i)
351351
time.Sleep(5 * time.Second)
352352
}
353353

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// -------------------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT License. See License.txt in the project root for license information.
4+
// --------------------------------------------------------------------------------------------
5+
6+
// +build e2e
7+
8+
package runner
9+
10+
import (
11+
"fmt"
12+
13+
"github.com/Azure/go-autorest/autorest/to"
14+
. "github.com/onsi/ginkgo"
15+
. "github.com/onsi/gomega"
16+
17+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
18+
"k8s.io/client-go/kubernetes"
19+
"k8s.io/klog"
20+
)
21+
22+
var _ = Describe("LFU", func() {
23+
var (
24+
clientset *kubernetes.Clientset
25+
err error
26+
)
27+
28+
Context("One Namespace One Ingress", func() {
29+
BeforeEach(func() {
30+
clientset, err = getClient()
31+
Expect(err).To(BeNil())
32+
cleanUp(clientset)
33+
})
34+
35+
It("[prohibited-target-test] prohibited service should be available to be accessed", func() {
36+
// get ip address for 1 ingress
37+
klog.Info("Getting public IP from blacklisted Ingress...")
38+
publicIP, _ := getPublicIP(clientset, "test-brownfield-ns")
39+
Expect(publicIP).ToNot(Equal(""))
40+
41+
//prohibited service will be kept by agic
42+
url_blacklist := fmt.Sprintf("http://%s/blacklist", publicIP)
43+
_, err = makeGetRequest(url_blacklist, "brownfield-blacklist-ns.host", 200, true)
44+
Expect(err).To(BeNil())
45+
46+
//delete namespaces for blacklist testing
47+
deleteOptions := &metav1.DeleteOptions{
48+
GracePeriodSeconds: to.Int64Ptr(0),
49+
}
50+
51+
klog.Info("Delete namespaces test-brownfield-ns after blacklist testing...")
52+
err = clientset.CoreV1().Namespaces().Delete("test-brownfield-ns", deleteOptions)
53+
Expect(err).To(BeNil())
54+
})
55+
})
56+
57+
})

scripts/e2e/cmd/runner/mfu_one_namespace_many_ingresses_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ var _ = Describe("MFU", func() {
109109
hosts := []string{"appa.", "appb."}
110110
url := fmt.Sprintf("https://%s/status/200", publicIP)
111111
klog.Infof("Sending get request %s ...", url)
112-
for i := 1; i <= 50; i++ {
112+
for i := 1; i <= 40; i++ {
113113
for _, host := range hosts {
114114
hostIndex := host + strconv.Itoa(i)
115115
klog.Infof("Sending request with host %s ...", hostIndex)
File renamed without changes.

scripts/e2e/cmd/runner/testdata/one-namespace-many-ingresses/fifty-ingresses-with-services/app/templates/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- range untilStep 1 51 1 }}
1+
{{- range untilStep 1 41 1 }}
22
apiVersion: apps/v1
33
kind: Deployment
44
metadata:

0 commit comments

Comments
 (0)