Skip to content

Commit

Permalink
ci(e2e): add e2e framework and example plugin case (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
shuaijinchao authored Mar 16, 2022
1 parent ed4dbe6 commit 3de14f8
Show file tree
Hide file tree
Showing 11 changed files with 648 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/runner-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#
# 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.
#

name: Runner E2E Test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
run-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: setup go
uses: actions/setup-go@v2.1.5
with:
go-version: "1.17"

- name: setup runner
run: |
make setup
make install
- name: startup runner
run: |
make dev &
- name: startup apisix
run: |
docker-compose -f ci/docker-compose.yml up -d
sleep 5
- name: install ginkgo cli
run: go install github.com/onsi/ginkgo/ginkgo@v1.16.5

- name: run tests
working-directory: ./tests/e2e
run: ginkgo -r
File renamed without changes.
2 changes: 2 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ header:
- '**/images/**'
- '**/config.json'
- '.github/'
- '**/go.mod'
- '**/go.sum'

comment: on-failure
37 changes: 37 additions & 0 deletions ci/apisix/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# 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.
#

apisix:
allow_admin:
- 0.0.0.0/0
enable_control: true
control:
ip: "0.0.0.0"
port: 9092
admin_key:
- name: admin
key: edd1c9f034335f136f87ad84b625c8f1
role: admin
etcd:
host:
- http://etcd:2379
prefix: "/apisix"
timeout: 30
ext-plugin:
path_for_test: /tmp/runner.sock
nginx_config:
user: root
64 changes: 64 additions & 0 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#
# 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"

services:
apisix:
image: apache/apisix:dev
restart: always
volumes:
- ./apisix/config.yaml:/usr/local/apisix/conf/config.yaml:ro
- /tmp/runner.sock:/tmp/runner.sock
depends_on:
- etcd
ports:
- "9080:9080/tcp"
- "9091:9091/tcp"
- "9443:9443/tcp"
- "9092:9092/tcp"
networks:
apisix:

etcd:
image: bitnami/etcd:3.4.9
restart: always
environment:
ETCD_ENABLE_V2: "true"
ALLOW_NONE_AUTHENTICATION: "yes"
ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379"
ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
ports:
- "2379:2379/tcp"
networks:
apisix:

web:
image: mendhak/http-https-echo
environment:
HTTP_PORT: 8888
HTTPS_PORT: 9999
restart: unless-stopped
ports:
- "8888:8888"
- "9999:9999"
networks:
apisix:

networks:
apisix:
driver: bridge
9 changes: 9 additions & 0 deletions tests/e2e/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/apache/apisix-python-plugin-runner/tests/e2e

go 1.16

require (
github.com/gavv/httpexpect/v2 v2.3.1
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.18.1
)
Loading

0 comments on commit 3de14f8

Please sign in to comment.