-
Notifications
You must be signed in to change notification settings - Fork 611
test: add e2e test for field hosts in route api
#612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
a3a7853
feat: ETCD cluster and APISIX cluster for CI
johzchen 2719106
feat: add test cases
johzchen 72d346d
feat: add upstream service in docker compose
johzchen cfe992f
fix: comment
johzchen 29baf39
test: add test cases
johzchen 279c9f0
fix: code format
johzchen 837252e
test: add ci
johzchen 45ff22c
fix ci
johzchen 13e6115
fix ci
johzchen 9c0bc0d
fix ci
johzchen d7f2b7f
fix: remove consumer test
johzchen 699b078
test: sleep for sync
johzchen ce3a1e1
test: e2e as an independent subproject
johzchen c78e882
fix CI error
johzchen 0e92420
test: run docker
johzchen 35cfea2
fix: remove json schema generate script in docker build
johzchen a1496db
fix: check host and hosts config together
johzchen 403fe3c
fix ci
johzchen cd41a44
test: add test cases for `host` in route
johzchen d5077e9
remove useless code
johzchen 6667e4f
fix: using relative path to read conf (#617)
nic-chen df84649
fix conf path
johzchen c8c9488
fix ci error
johzchen 7f34d39
fix etcd ip
johzchen bfd7393
fix: code format
johzchen bf019c6
Merge branch 'v2.0' into e2e-test
johzchen 6637d82
run backend e2e test ci on v2 branch
johzchen 8665571
fix: code format
johzchen 5f1946f
fix: code format
johzchen d003cd2
fix: CI error
johzchen 33df086
test: remove deploy CI again
johzchen b37d44a
remove useless codes
johzchen d934b86
fix: go fmt
johzchen f4e7eaf
test: don't use `go fmt`
johzchen 2f7dc48
fix: code format
johzchen 5e8bfb1
fix: var name
johzchen 48e7d23
fix lint
johzchen 5cbee07
fix CI error
johzchen fea0cbe
debug
johzchen b646565
fix: docker container name
johzchen b3aa489
fix CI error
johzchen 23d2477
fix CI error
johzchen 7d6116f
test: add more test cases
johzchen 73d7c01
fix CI error
johzchen ec597ab
chore: remove useless code
johzchen 0b48daf
fix: go fmt
johzchen 574ed83
fix: refactor test code
johzchen ea99394
fix: check body
johzchen 109f6ef
fix small issue
johzchen e4ebd73
fix: update docker compose
johzchen b2fbc01
fix CI
johzchen a84ec34
test
johzchen 71b6636
test
johzchen 4fddb26
test: build image first
johzchen c3f4b25
test: revert subnet ip in docker compose
johzchen bdc92af
fix by review
johzchen 0b4c109
fix: docker compose
johzchen 92e3d02
test: add test cases
johzchen d76ee2a
fix: remove useless code
johzchen fda136e
fix: code format
johzchen c58b375
test: code format
johzchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Backend E2E Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| - v2.0 | ||
|
|
||
| jobs: | ||
| run-test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: install runtime | ||
| run: | | ||
| sudo apt-get update | ||
| sudo add-apt-repository ppa:longsleep/golang-backports | ||
| sudo apt update | ||
| export GO111MOUDULE=on | ||
| sudo apt install golang-1.14-go | ||
|
|
||
| - name: run docker compose | ||
| working-directory: ./api/test/docker | ||
| run: | | ||
| docker-compose up -d | ||
| sleep 5 | ||
| docker logs docker_managerapi_1 | ||
|
|
||
| - name: run test | ||
| working-directory: ./api/test/e2e | ||
| run: | | ||
| go test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # If you want to set the specified configuration value, you can set the new | ||
| # in this file. For example if you want to specify the etcd address: | ||
| # | ||
| etcd: | ||
| host: | ||
| - "http://172.16.238.10:2379" | ||
| - "http://172.16.238.11:2379" | ||
| - "http://172.16.238.12:2379" | ||
|
|
||
| apisix: | ||
| admin_key: | ||
| - | ||
| name: "admin" | ||
| key: edd1c9f034335f136f87ad84b625c8f1 # using fixed API token has security risk, please | ||
| # update it when you deploy to production environment | ||
| role: admin | ||
|
|
||
| allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow | ||
| - 0.0.0.0/0 # If we don't set any IP list, then any IP access is allowed by default. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,183 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| version: "3.6" | ||
|
|
||
| services: | ||
| node1: | ||
| image: quay.io/coreos/etcd:v3.4.0 | ||
| ports: | ||
| - "2379:2379" | ||
| expose: | ||
| - 2379 | ||
| - 2380 | ||
| 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: quay.io/coreos/etcd:v3.4.0 | ||
| networks: | ||
| apisix_dashboard_e2e: | ||
| ipv4_address: 172.16.238.11 | ||
| environment: | ||
| - ETCDCTL_API=3 | ||
| 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: quay.io/coreos/etcd:v3.4.0 | ||
| networks: | ||
| apisix_dashboard_e2e: | ||
| ipv4_address: 172.16.238.12 | ||
| environment: | ||
| - ETCDCTL_API=3 | ||
| 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 | ||
|
|
||
| upstream: | ||
| image: johz/upstream:v2.0 | ||
| restart: always | ||
| volumes: | ||
| - ./upstream.conf:/etc/nginx/conf.d/default.conf:ro | ||
| ports: | ||
| - '80:80/tcp' | ||
| - '1980:1980/tcp' | ||
| - '1981:1981/tcp' | ||
| - '1982:1982/tcp' | ||
| - '1983:1983/tcp' | ||
| - '1984:1984/tcp' | ||
| networks: | ||
| apisix_dashboard_e2e: | ||
| ipv4_address: 172.16.238.20 | ||
|
|
||
| apisix: | ||
| image: apache/apisix:dev | ||
| restart: always | ||
| volumes: | ||
| - ./apisix_config.yaml:/usr/local/apisix/conf/config.yaml:ro | ||
| depends_on: | ||
| - node1 | ||
| - node2 | ||
| - node3 | ||
| ports: | ||
| - '9080:9080/tcp' | ||
| - '9443:9443/tcp' | ||
| networks: | ||
| apisix_dashboard_e2e: | ||
| ipv4_address: 172.16.238.30 | ||
|
|
||
| apisix2: | ||
| image: apache/apisix:dev | ||
| restart: always | ||
| volumes: | ||
| - ./apisix_config.yaml:/usr/local/apisix/conf/config.yaml:ro | ||
| depends_on: | ||
| - node1 | ||
| - node2 | ||
| - node3 | ||
| ports: | ||
| - '9081:9080/tcp' | ||
| networks: | ||
| apisix_dashboard_e2e: | ||
| ipv4_address: 172.16.238.31 | ||
|
|
||
| managerapi: | ||
| build: | ||
| context: ../../ | ||
| dockerfile: Dockerfile | ||
| restart: always | ||
| volumes: | ||
| - ./manager-api-conf.json:/go/manager-api/conf.json:ro | ||
| depends_on: | ||
| - node1 | ||
| - node2 | ||
| - node3 | ||
| ports: | ||
| - '8080:8080/tcp' | ||
| networks: | ||
| apisix_dashboard_e2e: | ||
| ipv4_address: 172.16.238.40 | ||
|
|
||
| networks: | ||
| apisix_dashboard_e2e: | ||
| driver: bridge | ||
| ipam: | ||
| driver: default | ||
| config: | ||
| - | ||
| subnet: 172.16.238.0/24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| { | ||
|
nic-chen marked this conversation as resolved.
|
||
| "conf": { | ||
| "syslog": { | ||
| "host": "127.0.0.1" | ||
| }, | ||
| "listen": { | ||
| "host": "0.0.0.0", | ||
| "port": 8080 | ||
| }, | ||
| "dag-lib-path": "", | ||
| "etcd": { | ||
| "endpoints": "172.16.238.10:2379,172.16.238.11:2379,172.16.238.12:2379" | ||
| } | ||
| }, | ||
| "authentication": { | ||
| "session": { | ||
| "secret": "secret", | ||
| "expireTime": 3600 | ||
| }, | ||
| "user": [ | ||
| { | ||
| "username": "admin", | ||
| "password": "admin" | ||
| }, | ||
| { | ||
|
membphis marked this conversation as resolved.
|
||
| "username": "user", | ||
| "password": "user" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.