Skip to content

Commit

Permalink
ci: clean up the E2E test environment (#2225)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzp2010 authored Nov 29, 2021
1 parent 41a1360 commit 9578937
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 98 deletions.
143 changes: 57 additions & 86 deletions api/test/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,19 @@
version: "3.6"

services:
node1:
image: gcr.io/etcd-development/etcd:v3.4.0
etcd1:
image: bitnami/etcd:3.5.1
environment:
- ALLOW_NONE_AUTHENTICATION=yes
- ETCD_DATA_DIR=/etcd-data
- ETCD_NAME=etcd1
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://172.16.238.10:2380
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
- ETCD_ADVERTISE_CLIENT_URLS=http://172.16.238.10:2379
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
- ETCD_INITIAL_CLUSTER=etcd1=http://172.16.238.10:2380,etcd2=http://172.16.238.11:2380,etcd3=http://172.16.238.12:2380
- ETCD_INITIAL_CLUSTER_STATE=new
- ETCD_INITIAL_CLUSTER_TOKEN=docker-etcd
ports:
- "2379:2379"
expose:
Expand All @@ -27,100 +38,61 @@ services:
networks:
apisix_dashboard_e2e:
ipv4_address: 172.16.238.10
environment:
- ETCDCTL_API=3
command:
- /usr/local/bin/etcd
- --data-dir=/etcd-data
- --name
- node1
- --initial-advertise-peer-urls
- http://172.16.238.10:2380
- --listen-peer-urls
- http://0.0.0.0:2380
- --advertise-client-urls
- http://172.16.238.10:2379
- --listen-client-urls
- http://0.0.0.0:2379
- --initial-cluster
- node1=http://172.16.238.10:2380,node2=http://172.16.238.11:2380,node3=http://172.16.238.12:2380
- --initial-cluster-state
- new
- --initial-cluster-token
- docker-etcd

node2:
image: gcr.io/etcd-development/etcd:v3.4.0
networks:
apisix_dashboard_e2e:
ipv4_address: 172.16.238.11
etcd2:
image: bitnami/etcd:3.5.1
environment:
- ETCDCTL_API=3
- ALLOW_NONE_AUTHENTICATION=yes
- ETCD_DATA_DIR=/etcd-data
- ETCD_NAME=etcd2
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://172.16.238.11:2380
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
- ETCD_ADVERTISE_CLIENT_URLS=http://172.16.238.11:2379
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
- ETCD_INITIAL_CLUSTER=etcd1=http://172.16.238.10:2380,etcd2=http://172.16.238.11:2380,etcd3=http://172.16.238.12:2380
- ETCD_INITIAL_CLUSTER_STATE=new
- ETCD_INITIAL_CLUSTER_TOKEN=docker-etcd
expose:
- 2379
- 2380
command:
- /usr/local/bin/etcd
- --data-dir=/etcd-data
- --name
- node2
- --initial-advertise-peer-urls
- http://172.16.238.11:2380
- --listen-peer-urls
- http://0.0.0.0:2380
- --advertise-client-urls
- http://172.16.238.11:2379
- --listen-client-urls
- http://0.0.0.0:2379
- --initial-cluster
- node1=http://172.16.238.10:2380,node2=http://172.16.238.11:2380,node3=http://172.16.238.12:2380
- --initial-cluster-state
- new
- --initial-cluster-token
- docker-etcd

node3:
image: gcr.io/etcd-development/etcd:v3.4.0
networks:
apisix_dashboard_e2e:
ipv4_address: 172.16.238.12
ipv4_address: 172.16.238.11

etcd3:
image: bitnami/etcd:3.5.1
environment:
- ETCDCTL_API=3
- ALLOW_NONE_AUTHENTICATION=yes
- ETCD_DATA_DIR=/etcd-data
- ETCD_NAME=etcd3
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://172.16.238.12:2380
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
- ETCD_ADVERTISE_CLIENT_URLS=http://172.16.238.12:2379
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
- ETCD_INITIAL_CLUSTER=etcd1=http://172.16.238.10:2380,etcd2=http://172.16.238.11:2380,etcd3=http://172.16.238.12:2380
- ETCD_INITIAL_CLUSTER_STATE=new
- ETCD_INITIAL_CLUSTER_TOKEN=docker-etcd
expose:
- 2379
- 2380
command:
- /usr/local/bin/etcd
- --data-dir=/etcd-data
- --name
- node3
- --initial-advertise-peer-urls
- http://172.16.238.12:2380
- --listen-peer-urls
- http://0.0.0.0:2380
- --advertise-client-urls
- http://172.16.238.12:2379
- --listen-client-urls
- http://0.0.0.0:2379
- --initial-cluster
- node1=http://172.16.238.10:2380,node2=http://172.16.238.11:2380,node3=http://172.16.238.12:2380
- --initial-cluster-state
- new
- --initial-cluster-token
- docker-etcd
networks:
apisix_dashboard_e2e:
ipv4_address: 172.16.238.12

upstream:
image: johz/upstream:v2.0
restart: always
volumes:
- ./upstream.conf:/etc/nginx/conf.d/default.conf:ro
- ./upstream.conf:/usr/local/openresty/nginx/conf/nginx.conf:ro
ports:
- '80:80/tcp'
- '1980:1980/tcp'
- '1981:1981/tcp'
- '1982:1982/tcp'
- '1983:1983/tcp'
- '1984:1984/tcp'
- '1991:1991/tcp'
- '1992:1992/udp'
networks:
apisix_dashboard_e2e:
ipv4_address: 172.16.238.20
Expand All @@ -147,17 +119,17 @@ services:

apisix:
hostname: apisix_server1
image: apache/apisix:2.10.0-alpine
image: apache/apisix:2.10.2-alpine
restart: always
volumes:
- ./apisix_config.yaml:/usr/local/apisix/conf/config.yaml:ro
- ../certs/apisix.crt:/usr/local/apisix/certs/apisix.crt:ro
- ../certs/apisix.key:/usr/local/apisix/certs/apisix.key:ro
- ./apisix_logs:/usr/local/apisix/logs
depends_on:
- node1
- node2
- node3
- etcd1
- etcd2
- etcd3
ports:
- '9080:9080/tcp'
- '9090:9090/tcp'
Expand All @@ -174,16 +146,16 @@ services:

apisix2:
hostname: apisix_server2
image: apache/apisix:2.7-alpine
image: apache/apisix:2.10.2-alpine
restart: always
volumes:
- ./apisix_config2.yaml:/usr/local/apisix/conf/config.yaml:ro
- ../certs/apisix.crt:/usr/local/apisix/certs/apisix.crt:ro
- ../certs/apisix.key:/usr/local/apisix/certs/apisix.key:ro
depends_on:
- node1
- node2
- node3
- etcd1
- etcd2
- etcd3
ports:
- '9081:9080/tcp'
networks:
Expand All @@ -199,9 +171,9 @@ services:
- ../../conf/conf.yaml:/go/manager-api/conf/conf.yaml:ro
- ../testdata:/go/manager-api/testdata
depends_on:
- node1
- node2
- node3
- etcd1
- etcd2
- etcd3
ports:
- '9000:9000/tcp'
networks:
Expand All @@ -225,5 +197,4 @@ networks:
ipam:
driver: default
config:
-
subnet: 172.16.238.0/24
- subnet: 172.16.238.0/24
55 changes: 43 additions & 12 deletions api/test/docker/upstream.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,42 @@
# limitations under the License.
#

log_format main '$remote_addr - $remote_user [$time_local] $request "$status" $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" "$request_time" "$upstream_response_time" ';
pcre_jit on;

lua_package_path "/usr/local/openresty/nginx/conf/lua/?.lua;;";
events {
worker_connections 1024;
}

server {
listen 80;
server_name localhost;
http {
include mime.types;
default_type application/octet-stream;

access_log off;
log_format main '$remote_addr - $remote_user [$time_local] $request "$status" $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" "$request_time" "$upstream_response_time" ';
lua_package_path "/usr/local/openresty/nginx/conf/lua/?.lua;;";

location / {
default_type text/html;
content_by_lua_block {
ngx.say(ngx.var.uri)
sendfile on;
keepalive_timeout 65;

server {
listen 80;
server_name localhost;

access_log off;

location / {
default_type text/html;
content_by_lua_block {
ngx.say(ngx.var.uri)
}
}
}
}

server {
listen 1980;
listen 1981;
listen 1982;
listen 5044;


server_tokens off;

location / {
Expand Down Expand Up @@ -67,6 +78,26 @@ server {
more_clear_headers Date;
}
}
}

stream {
server {
listen 1991;

content_by_lua_block {
local sock = ngx.req.socket()
local data = sock:receive()
sock:send(data)
}
}

server {
listen 1992 udp;

content_by_lua_block {
local sock = ngx.req.socket()
local data = sock:receive()
sock:send(data)
}
}
}

0 comments on commit 9578937

Please sign in to comment.