Skip to content

Commit

Permalink
Merge remote-tracking branch 'zx/topic/zhengxie/v4.2.0/traffic_e2e' i…
Browse files Browse the repository at this point in the history
…nto topic/zhengxie/v4.2.0/traffic_e2e

# Conflicts:
#	go.sum
#	test/e2e/framework.go
  • Loading branch information
zhengxiexie committed Dec 17, 2024
2 parents 7342ec8 + 80c44ad commit e7579fa
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
12 changes: 10 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/agiledragon/gomonkey/v2 v2.11.0 h1:5oxSgA+tC1xuGsrIorR+sYiziYltmJyEZ9
github.com/agiledragon/gomonkey/v2 v2.11.0/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU=
github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down Expand Up @@ -68,6 +70,8 @@ github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand All @@ -89,13 +93,17 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/moby/spdystream v0.4.0 h1:Vy79D6mHeJJjiPdFEL2yku1kl0chZpJfZcPpb16BRl8=
github.com/moby/spdystream v0.4.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
Expand Down Expand Up @@ -199,8 +207,8 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
Expand Down
22 changes: 21 additions & 1 deletion test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,27 +304,42 @@ func (data *TestData) createNamespace(namespace string, mutators ...func(ns *cor

// createVCNamespace creates a VC namespace with the provided namespace.
func (data *TestData) createVCNamespace(namespace string) error {
svID, err := data.vcClient.getSupervisorID()
err := testData.vcClient.startSession()

Check failure on line 307 in test/e2e/framework.go

View workflow job for this annotation

GitHub Actions / build

SA4006: this value of `err` is never used (staticcheck)
defer func() {
testData.vcClient.closeSession()
}()

svID, _ := data.vcClient.getSupervisorID()
vcNamespace := &VCNamespaceCreateSpec{
Supervisor: svID,
Namespace: namespace,
NetworkSpec: InstancesNetworkConfigInfo{
NetworkProvider: "NSX_VPC",
VpcNetwork: InstancesVpcNetworkInfo{
DefaultSubnetSize: 16,
},
},
}
dataJson, err := json.Marshal(vcNamespace)
if err != nil {
log.Error(err, "Unable convert vcNamespace object to json bytes", "namespace", namespace)
return fmt.Errorf("unable convert vcNamespace object to json bytes: %v", err)
}
urlPath := "/api/vcenter/namespaces/instances/v2"
request, err := data.vcClient.prepareRequest(http.MethodPost, urlPath, dataJson)
if err != nil {
log.Error(err, "Failed to prepare http request with vcNamespace data", "namespace", namespace)
return fmt.Errorf("failed to parepare http request with vcNamespace data: %v", err)
}
if _, err = data.vcClient.handleRequest(request, nil); err != nil {
log.Error(err, "Failed to create VC namespace", "namespace", namespace)
return err
}
// wait for the namespace on k8s running
err = wait.PollUntilContextTimeout(context.TODO(), 1*time.Second, defaultTimeout, false, func(ctx context.Context) (done bool, err error) {
ns, err := data.clientset.CoreV1().Namespaces().Get(context.TODO(), namespace, metav1.GetOptions{})
if err != nil {
log.Error(err, "Check namespace existence", "namespace", namespace)
return false, err
}
if ns.Status.Phase == corev1.NamespaceActive {
Expand All @@ -337,6 +352,11 @@ func (data *TestData) createVCNamespace(namespace string) error {

// deleteVCNamespace deletes the provided VC namespace and waits for deletion to actually complete.
func (data *TestData) deleteVCNamespace(namespace string) error {
err := testData.vcClient.startSession()

Check failure on line 355 in test/e2e/framework.go

View workflow job for this annotation

GitHub Actions / build

SA4006: this value of `err` is never used (staticcheck)
defer func() {
testData.vcClient.closeSession()
}()

urlPath := "/api/vcenter/namespaces/instances/v2/" + namespace
request, err := data.vcClient.prepareRequest(http.MethodDelete, urlPath, nil)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/manifest/testSecurityPolicy/busybox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
containers:
- name: busybox
image: wcp-docker-ci.artifactory.eng.vmware.com/test/busybox
image: daasops-docker-local.artifactory.vcfd.broadcom.net/busybox:test
command:
- /bin/sh
- "-c"
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/manifest/testSecurityPolicy/netcat-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ metadata:
spec:
containers:
- name: nc
image: "harbor-repo.vmware.com/dockerhub-proxy-cache\
/gophernet/netcat:latest"
image: "wcp-docker-ci.artifactory.vcfd.broadcom.net/gophernet/netcat:latest"
command: ["nc", "-l", "-p", "1234"]

0 comments on commit e7579fa

Please sign in to comment.