Skip to content

Commit 14ec7e9

Browse files
committed
change localhost to 127.0.0.1 as registry
1 parent 4311097 commit 14ec7e9

File tree

11 files changed

+38
-32
lines changed

11 files changed

+38
-32
lines changed

test/e2e/scaffold/apisix.go

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ import (
2121
"net/http"
2222
"strings"
2323

24+
"github.com/google/uuid"
2425
"github.com/gruntwork-io/terratest/modules/k8s"
2526
ginkgo "github.com/onsi/ginkgo/v2"
2627
corev1 "k8s.io/api/core/v1"
2728
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2829
)
2930

31+
var GatewayGroupName = uuid.NewString()
32+
3033
var (
3134
_apisixConfigMap = `
3235
kind: ConfigMap
@@ -74,7 +77,7 @@ data:
7477
spec:
7578
containers:
7679
- name: api7-ee-gateway-1
77-
image: localhost:5000/hkccr.ccs.tencentyun.com/api7-dev/api7-ee-3-gateway:dev
80+
image: 127.0.0.1:5000/hkccr.ccs.tencentyun.com/api7-dev/api7-ee-3-gateway:dev
7881
ports:
7982
- containerPort: 9080
8083
- containerPort: 9443
@@ -83,14 +86,6 @@ data:
8386
value: '["http://dp-manager:7900"]'
8487
- name: API7_CONTROL_PLANE_TOKEN
8588
value: %s
86-
volumeMounts:
87-
- name: config-volume
88-
mountPath: /usr/local/apisix/conf
89-
readOnly: true
90-
volumes:
91-
- name: config-volume
92-
hostPath:
93-
path: ./gateway_conf
9489
`
9590
)
9691

@@ -134,13 +129,13 @@ func (s *Scaffold) UploadLicense() error {
134129
}
135130

136131
type responseCreateGateway struct {
137-
Value responseCreateGatewayValue `json:"value"`
132+
Value responseCreateGatewayValue `json:"value"`
133+
ErrorMsg string `json:"error_msg"`
138134
}
139135
type responseCreateGatewayValue struct {
140136
ID string `json:"id"`
141137
TokenPlainText string `json:"token_plain_text"`
142138
Key string `json:"key"`
143-
ErrorMsg string `json:"error_msg"`
144139
}
145140

146141
func (s *Scaffold) GetAPIKey() (string, error) {
@@ -169,8 +164,8 @@ func (s *Scaffold) GetAPIKey() (string, error) {
169164
if err != nil {
170165
return "", err
171166
}
172-
if response.Value.ErrorMsg != "" {
173-
return "", fmt.Errorf("error getting key: %s", response.Value.ErrorMsg)
167+
if response.ErrorMsg != "" {
168+
return "", fmt.Errorf("error getting key: %s", response.ErrorMsg)
174169
}
175170
return response.Value.Key, nil
176171
}
@@ -196,11 +191,22 @@ func (s *Scaffold) DeleteGatewayGroup() error {
196191
return err
197192
}
198193
defer resp.Body.Close()
194+
195+
//unmarshal into responseCreateGateway
196+
var response responseCreateGateway
197+
err = json.NewDecoder(resp.Body).Decode(&response)
198+
if err != nil {
199+
return err
200+
}
201+
202+
if response.ErrorMsg != "" {
203+
return fmt.Errorf("error deleting gateway group: %s", response.ErrorMsg)
204+
}
199205
return nil
200206
}
201207

202208
func (s *Scaffold) CreateNewGatewayGroup() (string, error) {
203-
payload := []byte(`{"name":"ingress10","description":"","labels":{},"type":"api7_ingress_controller"}`)
209+
payload := []byte(fmt.Sprintf(`{"name":"%s","description":"","labels":{},"type":"api7_ingress_controller"}`, GatewayGroupName))
204210
url := fmt.Sprintf("http://%s:%d/api/gateway_groups", DashboardHost, DashboardPort)
205211
req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload))
206212
if err != nil {
@@ -210,7 +216,6 @@ func (s *Scaffold) CreateNewGatewayGroup() (string, error) {
210216

211217
// Set basic authentication
212218
req.SetBasicAuth("admin", "admin")
213-
214219
// Create an HTTP client
215220
client := &http.Client{}
216221

@@ -226,10 +231,10 @@ func (s *Scaffold) CreateNewGatewayGroup() (string, error) {
226231
if err != nil {
227232
return "", err
228233
}
229-
if response.Value.ErrorMsg != "" {
230-
return "", fmt.Errorf("error creating gateway group: %s", response.Value.ErrorMsg)
234+
235+
if response.ErrorMsg != "" {
236+
return "", fmt.Errorf("error creating gateway group: %s", response.ErrorMsg)
231237
}
232-
fmt.Println("GOT THE ID ", response.Value.ID)
233238
return response.Value.ID, nil
234239
}
235240

@@ -244,7 +249,7 @@ func (s *Scaffold) getTokenFromDashboard() (string, error) {
244249

245250
// Set basic authentication
246251
req.SetBasicAuth("admin", "admin")
247-
252+
fmt.Println("THE URL IS", url)
248253
// Create an HTTP client
249254
client := &http.Client{}
250255

@@ -268,6 +273,7 @@ func (s *Scaffold) newDataplane() (*corev1.Service, error) {
268273
if err != nil {
269274
return nil, err
270275
}
276+
fmt.Println("BHAI TOKEN YE HAI", token)
271277
if err := s.CreateResourceFromString(fmt.Sprintf(_eeDeployment, token)); err != nil {
272278
return nil, err
273279
}

test/e2e/scaffold/httpbin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ spec:
6363
tcpSocket:
6464
port: 80
6565
timeoutSeconds: 2
66-
image: "localhost:5000/httpbin:dev"
66+
image: "127.0.0.1:5000/httpbin:dev"
6767
imagePullPolicy: IfNotPresent
6868
name: httpbin-deployment-e2e-test
6969
ports:

test/e2e/scaffold/ingress.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ webhooks:
292292
var _initContainers = `
293293
initContainers:
294294
- name: wait-apisix-admin
295-
image: localhost:5000/busybox:dev
295+
image: 127.0.0.1:5000/busybox:dev
296296
imagePullPolicy: IfNotPresent
297297
command: ['sh', '-c', "until nc -z apisix-service-e2e-test 9180 ; do echo waiting for apisix-admin; sleep 2; done;"]
298298
`
@@ -385,7 +385,7 @@ spec:
385385
valueFrom:
386386
fieldRef:
387387
fieldPath: metadata.name
388-
image: "localhost:5000/apisix-ingress-controller:dev"
388+
image: "127.0.0.1:5000/apisix-ingress-controller:dev"
389389
imagePullPolicy: IfNotPresent
390390
name: ingress-apisix-controller-deployment-e2e-test
391391
ports:

test/e2e/scaffold/scaffold.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ func (s *Scaffold) renderConfig(path string, config any) (string, error) {
704704
func (s *Scaffold) FormatRegistry(workloadTemplate string) string {
705705
customRegistry, isExist := os.LookupEnv("REGISTRY")
706706
if isExist {
707-
return strings.Replace(workloadTemplate, "localhost:5000", customRegistry, -1)
707+
return strings.Replace(workloadTemplate, "127.0.0.1:5000", customRegistry, -1)
708708
} else {
709709
return workloadTemplate
710710
}

test/e2e/scaffold/test_backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ spec:
6666
tcpSocket:
6767
port: 80
6868
timeoutSeconds: 2
69-
image: "localhost:5000/test-backend:dev"
69+
image: "127.0.0.1:5000/test-backend:dev"
7070
imagePullPolicy: IfNotPresent
7171
name: test-backend-deployment-e2e-test
7272
ports:

test/e2e/suite-annotations/websocket.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ metadata:
4040
spec:
4141
containers:
4242
- name: websocket-server
43-
image: localhost:5000/echo-server:dev
43+
image: 127.0.0.1:5000/echo-server:dev
4444
ports:
4545
- containerPort: 8080
4646
---
@@ -126,7 +126,7 @@ metadata:
126126
spec:
127127
containers:
128128
- name: websocket-server
129-
image: localhost:5000/echo-server:dev
129+
image: 127.0.0.1:5000/echo-server:dev
130130
ports:
131131
- containerPort: 8080
132132
---

test/e2e/suite-features/external-sd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"github.com/api7/api7-ingress-controller/test/e2e/scaffold"
3131
)
3232

33-
var _ = ginkgo.Describe("suite-features: external service discovery", func() {
33+
var _ = ginkgo.FDescribe("suite-features: external service discovery", func() {
3434

3535
PhaseCreateApisixRoute := func(s *scaffold.Scaffold, name, upstream string) {
3636
ar := fmt.Sprintf(`
@@ -160,7 +160,7 @@ spec:
160160
tcpSocket:
161161
port: 80
162162
timeoutSeconds: 2
163-
image: "localhost:5000/httpbin:dev"
163+
image: "127.0.0.1:5000/httpbin:dev"
164164
imagePullPolicy: IfNotPresent
165165
name: httpbin
166166
ports:

test/e2e/suite-features/external-service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ spec:
207207
tcpSocket:
208208
port: 80
209209
timeoutSeconds: 2
210-
image: "localhost:5000/httpbin:dev"
210+
image: "127.0.0.1:5000/httpbin:dev"
211211
imagePullPolicy: IfNotPresent
212212
name: httpbin
213213
ports:

test/e2e/suite-features/websocket.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ metadata:
4141
spec:
4242
containers:
4343
- name: websocket-server
44-
image: localhost:5000/echo-server:dev
44+
image: 127.0.0.1:5000/echo-server:dev
4545
ports:
4646
- containerPort: 8080
4747
---

test/e2e/suite-gateway/gateway_httproute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ spec:
378378
spec:
379379
containers:
380380
- name: echo
381-
image: localhost:5000/echo-server:dev
381+
image: 127.0.0.1:5000/echo-server:dev
382382
ports:
383383
- containerPort: 8080
384384
---

test/e2e/suite-ingress/suite-ingress-resource/resourcepushing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ spec:
602602
tcpSocket:
603603
port: 80
604604
timeoutSeconds: 2
605-
image: "localhost:5000/httpbin:dev"
605+
image: "127.0.0.1:5000/httpbin:dev"
606606
imagePullPolicy: IfNotPresent
607607
name: httpbin-temp
608608
ports:

0 commit comments

Comments
 (0)