Skip to content

Commit

Permalink
Make e2e test itself in github action (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
chunriyeqiongsaigao committed Sep 4, 2023
1 parent 0f31b43 commit 935338e
Show file tree
Hide file tree
Showing 9 changed files with 305 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Licensed to 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. Apache Software Foundation (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: E2E Test

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- main

jobs:
build:
name: E2E Test
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.18
uses: actions/setup-go@v4
with:
go-version: 1.18
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Build e2e
run: make linux

- name: Run E2E Test
uses: apache/skywalking-infra-e2e@main
with:
e2e-file: ./test/e2e/e2e.yaml



21 changes: 21 additions & 0 deletions test/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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: '2.1'
services:
httpbin:
image: kennethreitz/httpbin
ports:
- "8080:80"
48 changes: 48 additions & 0 deletions test/e2e/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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.

# This file is used to show how to write configuration files and can be used to test.

setup:
env: compose
file: docker-compose.yml
timeout: 20m

cleanup:
# always never success failure
on: always

verify:
# verify with retry strategy
retry:
# max retry count
count: 1
# the interval between two attempts, e.g. 10s, 1m.
interval: 1s

# when a case fails, whether to stop verifying other cases. This property defaults to true.
fail-fast: false
# Whether to verify cases concurrently. This property defaults to false.
concurrency: false


cases:
- name: fail-fast
query: './bin/linux/e2e verify -c ./test/e2e/fail-fast/internal/verify.yaml --summary-only -o yaml'
expected: ./fail-fast/expected.yaml

- name: non-fail-fast
query: './bin/linux/e2e verify -c ./test/e2e/non-fail-fast/internal/verify.yaml --summary-only -o yaml'
expected: ./non-fail-fast/expected.yaml
23 changes: 23 additions & 0 deletions test/e2e/fail-fast/expected.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Licensed to 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. Apache Software Foundation (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.

passed:
- case-1
- case-2
failed:
- case-3
skipped: []
25 changes: 25 additions & 0 deletions test/e2e/fail-fast/internal/expected.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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.

# This file is used to show how to write configuration files and can be used to test.

args:
case: success
headers:
Accept: application/json
Host: 127.0.0.1:8080
User-Agent: curl/7.81.0
origin: 172.18.0.1
url: http://127.0.0.1:8080/get?case=success
41 changes: 41 additions & 0 deletions test/e2e/fail-fast/internal/verify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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.

# This file is used to show how to write configuration files and can be used to test.

verify:
# verify with retry strategy
retry:
# max retry count
count: 5
# the interval between two attempts, e.g. 10s, 1m.
interval: 1s

# when a case fails, whether to stop verifying other cases. This property defaults to true.
fail-fast: true
# Whether to verify cases concurrently. This property defaults to false.
concurrency: false


cases:
- name: case-1
query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"'
expected: ./expected.yaml
- name: case-2
query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"'
expected: ./expected.yaml
- name: case-3
query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"'
expected: ./expected.yaml
24 changes: 24 additions & 0 deletions test/e2e/non-fail-fast/expected.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Licensed to 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. Apache Software Foundation (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.

passed:
- case-1
- case-2
- case-4
failed:
- case-3
skipped: []
25 changes: 25 additions & 0 deletions test/e2e/non-fail-fast/internal/expected.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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.

# This file is used to show how to write configuration files and can be used to test.

args:
case: success
headers:
Accept: application/json
Host: 127.0.0.1:8080
User-Agent: curl/7.81.0
origin: 172.18.0.1
url: http://127.0.0.1:8080/get?case=success
44 changes: 44 additions & 0 deletions test/e2e/non-fail-fast/internal/verify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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.

# This file is used to show how to write configuration files and can be used to test.

verify:
# verify with retry strategy
retry:
# max retry count
count: 5
# the interval between two attempts, e.g. 10s, 1m.
interval: 1s

# when a case fails, whether to stop verifying other cases. This property defaults to true.
fail-fast: false
# Whether to verify cases concurrently. This property defaults to false.
concurrency: false


cases:
- name: case-1
query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"'
expected: ./expected.yaml
- name: case-2
query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"'
expected: ./expected.yaml
- name: case-3
query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"'
expected: ./expected.yaml
- name: case-4
query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"'
expected: ./expected.yaml

0 comments on commit 935338e

Please sign in to comment.