Skip to content

Commit 9935195

Browse files
authored
Merge pull request #7 from LinuxSuRen/feat/get-suite-detail
feat: support to get test suites with details
2 parents 345d77e + b327746 commit 9935195

File tree

10 files changed

+465
-12
lines changed

10 files changed

+465
-12
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git/
2+
.github/

.github/workflows/build.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ jobs:
3333
BuildImage:
3434
runs-on: ubuntu-20.04
3535
steps:
36-
- name: Set up Go
37-
uses: actions/setup-go@v3
38-
with:
39-
go-version: 1.20.x
4036
- uses: actions/[email protected]
4137
- name: Image
4238
run: make build-image
39+
40+
RunE2E:
41+
runs-on: ubuntu-20.04
42+
steps:
43+
- uses: actions/[email protected]
44+
- name: Run e2e
45+
run: |
46+
sudo curl -L https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
47+
sudo chmod u+x /usr/local/bin/docker-compose
48+
make run-e2e

Dockerfile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
FROM golang:1.20 AS builder
1+
ARG GO_BUILDER=docker.io/library/golang:1.20
2+
ARG BASE_IMAGE=docker.io/library/alpine:3.12
3+
4+
FROM ${GO_BUILDER} AS builder
25

36
ARG VERSION
47
ARG GOPROXY
58
WORKDIR /workspace
6-
COPY cmd/ cmd/
7-
COPY pkg/ pkg/
8-
COPY go.mod go.mod
9-
COPY go.sum go.sum
10-
COPY main.go main.go
11-
COPY README.md README.md
9+
COPY . .
1210

1311
RUN GOPROXY=${GOPROXY} go mod download
1412
RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -ldflags "-w -s" -o atest-store-orm .
1513

16-
FROM alpine:3.12
14+
FROM ${BASE_IMAGE}
1715

1816
LABEL org.opencontainers.image.source=https://github.com/LinuxSuRen/atest-ext-store-orm
1917
LABEL org.opencontainers.image.description="ORM database Store Extension of the API Testing."

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ hd:
1313
init-env: hd
1414
hd i cli/cli
1515
gh extension install linuxsuren/gh-dev
16+
run-e2e:
17+
cd e2e && ./start.sh

e2e/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM docker.io/library/e2e-extension as ext
2+
FROM ghcr.io/linuxsuren/api-testing:master
3+
4+
WORKDIR /workspace
5+
COPY . .
6+
COPY --from=ext /usr/local/bin/atest-store-orm /usr/local/bin/atest-store-orm
7+
8+
CMD [ "/workspace/entrypoint.sh" ]

e2e/compose.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: '3.1'
2+
services:
3+
testing:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
depends_on:
8+
mysql:
9+
condition: service_healthy
10+
extension:
11+
condition: service_started
12+
volumes:
13+
- type: volume
14+
source: cache
15+
target: /var/data
16+
links:
17+
- mysql
18+
extension:
19+
build:
20+
context: ..
21+
dockerfile: Dockerfile
22+
args:
23+
- "GO_BUILDER=ghcr.io/linuxsuren/library/golang:1.20"
24+
- "BASE_IMAGE=ghcr.io/linuxsuren/library/alpine:3.12"
25+
mysql:
26+
image: mysql:8.2.0
27+
command: --default-authentication-plugin=mysql_native_password
28+
environment:
29+
MYSQL_ROOT_PASSWORD: root
30+
MYSQL_DATABASE: atest
31+
healthcheck:
32+
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306"]
33+
interval: 3s
34+
timeout: 60s
35+
retries: 10
36+
start_period: 3s
37+
38+
volumes:
39+
cache:

e2e/entrypoint.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
5+
mkdir -p /root/.config/atest
6+
mkdir -p /var/data
7+
8+
echo "start to run server"
9+
nohup atest server&
10+
cmd="atest run -p test-suite.yaml"
11+
12+
echo "start to run testing: $cmd"
13+
kind=orm target=mysql:3306 driver=mysql $cmd
14+
15+
cat /root/.config/atest/stores.yaml

e2e/start.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
file=$1
4+
if [ "$file" == "" ]
5+
then
6+
file=compose.yaml
7+
fi
8+
9+
docker compose version
10+
docker compose -f "$file" down
11+
docker compose -f "$file" up --build testing --exit-code-from testing --remove-orphans

0 commit comments

Comments
 (0)