Skip to content
Permalink
Browse files
feat(ci): add e2e test framework (#133)
  • Loading branch information
shuaijinchao committed Mar 10, 2022
1 parent 65c6fcd commit 8a8a8a3a867a6ed9f48c7a9b931eb0c69a575e98
Showing 10 changed files with 654 additions and 0 deletions.
@@ -0,0 +1,73 @@
#
# 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:
- main
pull_request:
branches:
- main

env:
JAVA_RUNNER_VERSION: 0.2.0


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

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

- name: setup java
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'

- name: build runner
run: |
cp ./sample/src/main/java/org/apache/apisix/plugin/runner/filter/* ./runner-plugin/src/main/java/org/apache/apisix/plugin/runner/filter/
./mvnw install
- name: startup runner
run: |
cd dist
tar -zxvf apache-apisix-java-plugin-runner-$JAVA_RUNNER_VERSION-bin.tar.gz
java -jar -DAPISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock -DAPISIX_CONF_EXPIRE_TIME=3600 ./apisix-runner-bin/apisix-java-plugin-runner.jar &
- 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
@@ -31,5 +31,7 @@ header:
- '.github/ISSUE_TEMPLATE'
- '.github/PULL_REQUEST_TEMPLATE'
- 'docs/**/**/config.json'
- '**/go.mod'
- '**/go.sum'

comment: on-failure
@@ -0,0 +1,38 @@
#
# 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
@@ -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:2.12.0-alpine
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
@@ -0,0 +1,9 @@
module github.com/apache/apisix-java-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
)

0 comments on commit 8a8a8a3

Please sign in to comment.