Skip to content

Commit d168119

Browse files
authored
chore: simplify e2e environment (#2694)
1 parent c1cf4d4 commit d168119

File tree

86 files changed

+2620
-2894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2620
-2894
lines changed

.github/workflows/backend-e2e-test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222

2323
steps:
2424
- uses: actions/checkout@v3
25+
with:
26+
submodules: recursive
2527

2628
- name: setup go
2729
uses: actions/setup-go@v3
@@ -40,10 +42,8 @@ jobs:
4042
4143
- name: Modify conf.yaml Configure for use by the manage-api cluster
4244
run: |
43-
sed -i 's/127.0.0.1:2379/172.16.238.10:2379/' ./api/conf/conf.yaml
45+
sed -i 's/127.0.0.1:2379/etcd:2379/' ./api/conf/conf.yaml
4446
sed -i '[email protected]@0.0.0.0/0@' ./api/conf/conf.yaml
45-
sed -i '/172.16.238.10:2379/a\ - 172.16.238.11:2379' ./api/conf/conf.yaml
46-
sed -i '/172.16.238.10:2379/a\ - 172.16.238.12:2379' ./api/conf/conf.yaml
4747
sed -i '[email protected]/0:[email protected]:9000@' ./api/conf/conf.yaml
4848
sed -i 's/enabled: false/enabled: true/' ./api/conf/conf.yaml
4949
@@ -76,11 +76,13 @@ jobs:
7676
docker logs docker_managerapi_1
7777
7878
- name: install ginkgo cli
79-
run: go install github.com/onsi/ginkgo/ginkgo@v1.16.5
79+
run: go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo@latest
8080

8181
- name: run test
8282
working-directory: ./api/test/e2e
83-
run: ginkgo -r
83+
run: |
84+
go mod download
85+
ginkgo -r --flake-attempts=3 -v
8486
8587
- name: stop docker compose
8688
working-directory: ./api/test/docker

api/test/docker/apisix_config.yaml

Lines changed: 10 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,20 @@
1919
#
2020
etcd:
2121
host:
22-
- "http://172.16.238.10:2379"
23-
- "http://172.16.238.11:2379"
24-
- "http://172.16.238.12:2379"
25-
resync_delay: 0 # sync data from etcd quickly for e2e test
22+
- "http://etcd:2379"
23+
resync_delay: 0
2624

2725
apisix:
2826
id: "apisix-server1"
2927
admin_key:
30-
-
31-
name: "admin" # yamllint disable rule:comments-indentation
32-
key: edd1c9f034335f136f87ad84b625c8f1 # using fixed API token has security risk, please
33-
# update it when you deploy to production environment
34-
role: admin # yamllint enable rule:comments-indentation
35-
36-
allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
37-
- 0.0.0.0/0 # If we don't set any IP list, then any IP access is allowed by default.
38-
39-
ssl:
40-
enable: true
41-
ssl_cert: "/usr/local/apisix/certs/apisix.crt"
42-
ssl_cert_key: "/usr/local/apisix/certs/apisix.key"
43-
28+
- name: "admin"
29+
key: edd1c9f034335f136f87ad84b625c8f1
30+
role: admin
31+
allow_admin:
32+
- 0.0.0.0/0
33+
admin_listen:
34+
ip: 0.0.0.0
35+
port: 9180
4436
enable_control: true
4537
control:
4638
ip: "0.0.0.0"
@@ -59,53 +51,7 @@ apisix:
5951
nginx_config:
6052
error_log_level: "debug"
6153

62-
plugins: # plugin list (sorted in alphabetical order)
63-
- api-breaker
64-
- authz-keycloak
65-
- basic-auth
66-
- batch-requests
67-
- consumer-restriction
68-
- cors
69-
- echo
70-
- fault-injection
71-
- grpc-transcode
72-
- hmac-auth
73-
- http-logger
74-
- ip-restriction
75-
- jwt-auth
76-
- kafka-logger
77-
- key-auth
78-
- limit-conn
79-
- limit-count
80-
- limit-req
81-
- node-status
82-
- openid-connect
83-
- prometheus
84-
- proxy-cache
85-
- proxy-mirror
86-
- proxy-rewrite
87-
- redirect
88-
- referer-restriction
89-
- request-id
90-
- request-validation
91-
- response-rewrite
92-
- serverless-post-function
93-
- serverless-pre-function
94-
- skywalking
95-
- sls-logger
96-
- syslog
97-
- tcp-logger
98-
- udp-logger
99-
- uri-blocker
100-
- wolf-rbac
101-
- zipkin
102-
- server-info
103-
10454
plugin_attr:
105-
skywalking:
106-
service_name: APISIX
107-
service_instance_name: "APISIX Instance Name"
108-
endpoint_addr: http://172.16.238.50:12800
10955
server-info:
11056
report_interval: 60
11157
report_ttl: 3600

api/test/docker/apisix_config2.yaml

Lines changed: 10 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -19,80 +19,26 @@
1919
#
2020
etcd:
2121
host:
22-
- "http://172.16.238.10:2379"
23-
- "http://172.16.238.11:2379"
24-
- "http://172.16.238.12:2379"
25-
resync_delay: 0 # sync data from etcd quickly for e2e test
22+
- "http://etcd:2379"
23+
resync_delay: 0
2624

2725
apisix:
2826
id: "apisix-server2"
2927
admin_key:
30-
-
31-
name: "admin" # yamllint disable rule:comments-indentation
32-
key: edd1c9f034335f136f87ad84b625c8f1 # using fixed API token has security risk, please
33-
# update it when you deploy to production environment
34-
role: admin # yamllint enable rule:comments-indentation
35-
36-
allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
37-
- 0.0.0.0/0 # If we don't set any IP list, then any IP access is allowed by default.
38-
39-
ssl:
40-
enable: true
41-
ssl_cert: "/usr/local/apisix/certs/apisix.crt"
42-
ssl_cert_key: "/usr/local/apisix/certs/apisix.key"
28+
- name: "admin"
29+
key: edd1c9f034335f136f87ad84b625c8f1
30+
role: admin
31+
allow_admin:
32+
- 0.0.0.0/0
33+
admin_listen:
34+
ip: 0.0.0.0
35+
port: 9180
4336

4437
nginx_config:
4538
error_log_level: "debug"
4639
worker_processes: "1"
4740

48-
plugins: # plugin list (sorted in alphabetical order)
49-
- api-breaker
50-
- authz-keycloak
51-
- basic-auth
52-
- batch-requests
53-
- consumer-restriction
54-
- cors
55-
- echo
56-
- fault-injection
57-
- grpc-transcode
58-
- hmac-auth
59-
- http-logger
60-
- ip-restriction
61-
- jwt-auth
62-
- kafka-logger
63-
- key-auth
64-
- limit-conn
65-
- limit-count
66-
- limit-req
67-
- node-status
68-
- openid-connect
69-
- prometheus
70-
- proxy-cache
71-
- proxy-mirror
72-
- proxy-rewrite
73-
- redirect
74-
- referer-restriction
75-
- request-id
76-
- request-validation
77-
- response-rewrite
78-
- serverless-post-function
79-
- serverless-pre-function
80-
- skywalking
81-
- sls-logger
82-
- syslog
83-
- tcp-logger
84-
- udp-logger
85-
- uri-blocker
86-
- wolf-rbac
87-
- zipkin
88-
- server-info
89-
9041
plugin_attr:
91-
skywalking:
92-
service_name: APISIX
93-
service_instance_name: "APISIX Instance Name"
94-
endpoint_addr: http://172.16.238.50:12800
95-
9642
server-info:
9743
report_interval: 60
9844
report_ttl: 3600

api/test/docker/docker-compose.yaml

Lines changed: 10 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -17,68 +17,18 @@
1717
version: "3.6"
1818

1919
services:
20-
etcd1:
21-
image: bitnami/etcd:3.5.2
20+
etcd:
21+
image: bitnami/etcd:3.5
2222
environment:
2323
- ALLOW_NONE_AUTHENTICATION=yes
24-
- ETCD_DATA_DIR=/etcd-data
25-
- ETCD_NAME=etcd1
26-
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://172.16.238.10:2380
27-
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
28-
- ETCD_ADVERTISE_CLIENT_URLS=http://172.16.238.10:2379
24+
- ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
2925
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
30-
- ETCD_INITIAL_CLUSTER=etcd1=http://172.16.238.10:2380,etcd2=http://172.16.238.11:2380,etcd3=http://172.16.238.12:2380
31-
- ETCD_INITIAL_CLUSTER_STATE=new
32-
- ETCD_INITIAL_CLUSTER_TOKEN=docker-etcd
3326
ports:
3427
- "2379:2379"
35-
expose:
36-
- 2379
37-
- 2380
3828
networks:
3929
apisix_dashboard_e2e:
4030
ipv4_address: 172.16.238.10
4131

42-
etcd2:
43-
image: bitnami/etcd:3.5.2
44-
environment:
45-
- ALLOW_NONE_AUTHENTICATION=yes
46-
- ETCD_DATA_DIR=/etcd-data
47-
- ETCD_NAME=etcd2
48-
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://172.16.238.11:2380
49-
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
50-
- ETCD_ADVERTISE_CLIENT_URLS=http://172.16.238.11:2379
51-
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
52-
- ETCD_INITIAL_CLUSTER=etcd1=http://172.16.238.10:2380,etcd2=http://172.16.238.11:2380,etcd3=http://172.16.238.12:2380
53-
- ETCD_INITIAL_CLUSTER_STATE=new
54-
- ETCD_INITIAL_CLUSTER_TOKEN=docker-etcd
55-
expose:
56-
- 2379
57-
- 2380
58-
networks:
59-
apisix_dashboard_e2e:
60-
ipv4_address: 172.16.238.11
61-
62-
etcd3:
63-
image: bitnami/etcd:3.5.2
64-
environment:
65-
- ALLOW_NONE_AUTHENTICATION=yes
66-
- ETCD_DATA_DIR=/etcd-data
67-
- ETCD_NAME=etcd3
68-
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://172.16.238.12:2380
69-
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
70-
- ETCD_ADVERTISE_CLIENT_URLS=http://172.16.238.12:2379
71-
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
72-
- ETCD_INITIAL_CLUSTER=etcd1=http://172.16.238.10:2380,etcd2=http://172.16.238.11:2380,etcd3=http://172.16.238.12:2380
73-
- ETCD_INITIAL_CLUSTER_STATE=new
74-
- ETCD_INITIAL_CLUSTER_TOKEN=docker-etcd
75-
expose:
76-
- 2379
77-
- 2380
78-
networks:
79-
apisix_dashboard_e2e:
80-
ipv4_address: 172.16.238.12
81-
8232
upstream:
8333
image: johz/upstream:v2.0
8434
restart: always
@@ -109,22 +59,21 @@ services:
10959

11060
apisix:
11161
hostname: apisix_server1
112-
image: apache/apisix:2.10.2-alpine
62+
image: apache/apisix:2.15.1-debian
11363
restart: always
11464
volumes:
11565
- ./apisix_config.yaml:/usr/local/apisix/conf/config.yaml:ro
11666
- ../certs/apisix.crt:/usr/local/apisix/certs/apisix.crt:ro
11767
- ../certs/apisix.key:/usr/local/apisix/certs/apisix.key:ro
11868
- ./apisix_logs:/usr/local/apisix/logs
11969
depends_on:
120-
- etcd1
121-
- etcd2
122-
- etcd3
70+
- etcd
12371
ports:
12472
- '9080:9080/tcp'
12573
- '9090:9090/tcp'
12674
- '9091:9091/tcp'
12775
- '9443:9443/tcp'
76+
- '9180:9180/tcp'
12877
- '10090:10090/tcp'
12978
- '10091:10091/tcp'
13079
- '10092:10092/tcp'
@@ -136,18 +85,17 @@ services:
13685

13786
apisix2:
13887
hostname: apisix_server2
139-
image: apache/apisix:2.10.2-alpine
88+
image: apache/apisix:2.15.1-debian
14089
restart: always
14190
volumes:
14291
- ./apisix_config2.yaml:/usr/local/apisix/conf/config.yaml:ro
14392
- ../certs/apisix.crt:/usr/local/apisix/certs/apisix.crt:ro
14493
- ../certs/apisix.key:/usr/local/apisix/certs/apisix.key:ro
14594
depends_on:
146-
- etcd1
147-
- etcd2
148-
- etcd3
95+
- etcd
14996
ports:
15097
- '9081:9080/tcp'
98+
- '9181:9180/tcp'
15199
networks:
152100
apisix_dashboard_e2e:
153101
ipv4_address: 172.16.238.31
@@ -161,26 +109,13 @@ services:
161109
- ../../conf/conf.yaml:/go/manager-api/conf/conf.yaml:ro
162110
- ../testdata:/go/manager-api/testdata
163111
depends_on:
164-
- etcd1
165-
- etcd2
166-
- etcd3
112+
- etcd
167113
ports:
168114
- '9000:9000/tcp'
169115
networks:
170116
apisix_dashboard_e2e:
171117
ipv4_address: 172.16.238.40
172118

173-
skywalking:
174-
image: apache/skywalking-oap-server:8.3.0-es6
175-
restart: always
176-
ports:
177-
- '1234:1234/tcp'
178-
- '11800:11800/tcp'
179-
- '12800:12800/tcp'
180-
networks:
181-
apisix_dashboard_e2e:
182-
ipv4_address: 172.16.238.50
183-
184119
keycloak:
185120
image: jboss/keycloak:9.0.2
186121
environment:

api/test/e2e/auth/auth_suite_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,19 @@ package auth_test
1818

1919
import (
2020
"testing"
21+
"time"
2122

22-
. "github.com/onsi/ginkgo"
23+
"github.com/apisix/manager-api/test/e2e/base"
24+
. "github.com/onsi/ginkgo/v2"
2325
. "github.com/onsi/gomega"
2426
)
2527

2628
func TestAuth(t *testing.T) {
2729
RegisterFailHandler(Fail)
2830
RunSpecs(t, "Auth Suite")
2931
}
32+
33+
var _ = BeforeSuite(func() {
34+
base.CleanAllResource()
35+
time.Sleep(base.SleepTime)
36+
})

0 commit comments

Comments
 (0)