-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from LinuxSuRen/springboot-test
add springboot inital code
- Loading branch information
Showing
21 changed files
with
786 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,21 @@ | ||
name: Build | ||
|
||
on: | ||
- pull_request | ||
|
||
jobs: | ||
Build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Image | ||
run: make build-image | ||
- name: Run e2e | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PULL_REQUEST: ${{ github.event.number }} | ||
run: | | ||
sudo curl -L https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose | ||
sudo chmod u+x /usr/local/bin/docker-compose | ||
export OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') | ||
make test-e2e |
This file contains 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,33 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ |
This file contains 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,4 @@ | ||
vscode: | ||
extensions: | ||
- linuxsuren.api-testing | ||
- vscjava.vscode-maven |
Binary file not shown.
This file contains 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,2 @@ | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip | ||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar |
This file contains 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,8 @@ | ||
FROM maven:3.9.5-sapmachine-17 | ||
|
||
WORKDIR /workspace | ||
COPY . . | ||
|
||
RUN mvn package | ||
|
||
CMD [ "java", "-jar", "target/demo-0.0.1-SNAPSHOT.jar" ] |
This file contains 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,6 @@ | ||
build-image: | ||
docker build . -t ghcr.io/devops-ws/learn-springboot:master | ||
test-e2e: | ||
cd e2e && ./start.sh | ||
run-demo: | ||
cd e2e && docker compose up server |
This file contains 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 |
---|---|---|
@@ -1 +1,8 @@ | ||
# learn-springboot | ||
# learn-springboot | ||
This project aims to verify [linuxsuren/api-testing](https://github.com/LinuxSuRen/api-testing). | ||
|
||
Run E2E testing: | ||
|
||
```shell | ||
make build-image test-e2e | ||
``` |
This file contains 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,6 @@ | ||
FROM ghcr.io/linuxsuren/api-testing:master | ||
|
||
WORKDIR /workspace | ||
COPY . . | ||
|
||
CMD [ "/workspace/entrypoint.sh" ] |
This file contains 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,25 @@ | ||
version: '3.1' | ||
services: | ||
testing: | ||
build: | ||
context: . | ||
environment: | ||
SERVER: http://server:8080 | ||
OWNER: "$OWNER" | ||
GITHUB_TOKEN: "$GITHUB_TOKEN" | ||
PULL_REQUEST: "$PULL_REQUEST" | ||
depends_on: | ||
server: | ||
condition: service_healthy | ||
links: | ||
- server | ||
server: | ||
image: ghcr.io/devops-ws/learn-springboot:master | ||
ports: | ||
- 8080:8080 | ||
healthcheck: | ||
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/8080"] | ||
interval: 3s | ||
timeout: 60s | ||
retries: 10 | ||
start_period: 3s |
This file contains 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,18 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
mkdir -p /var/data | ||
|
||
atest run -p test-suite.yaml --report md | ||
|
||
# cannot get the token in a pr | ||
# if [[ "$PULL_REQUEST" == "" || "$GITHUB_TOKEN" == "" ]]; | ||
# then | ||
# atest run -p test-suite.yaml --report md | ||
# else | ||
# atest run -p test-suite.yaml --report github \ | ||
# --report-github-identity e2e-testing \ | ||
# --report-file /var/data/report.json \ | ||
# --report-github-repo ${OWNER:-devops-ws}/learn-springboot \ | ||
# --report-github-pr ${PULL_REQUEST:-0} | ||
# fi |
This file contains 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 @@ | ||
#!/bin/bash | ||
|
||
file=$1 | ||
if [ "$file" == "" ] | ||
then | ||
file=compose.yaml | ||
fi | ||
|
||
docker-compose version | ||
docker-compose -f "$file" up --build -d | ||
|
||
while true | ||
do | ||
docker-compose -f "$file" ps | grep testing | ||
if [ $? -eq 1 ] | ||
then | ||
code=-1 | ||
docker-compose -f "$file" logs | grep e2e-testing | ||
docker-compose -f "$file" logs | grep e2e-testing | grep Usage | ||
if [ $? -eq 1 ] | ||
then | ||
code=0 | ||
echo "successed" | ||
fi | ||
|
||
docker-compose -f "$file" down | ||
set -e | ||
exit $code | ||
fi | ||
sleep 1 | ||
done |
This file contains 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,19 @@ | ||
#!api-testing | ||
# yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-schema.json | ||
name: SpringBoot | ||
api: | | ||
{{default "http://localhost:8080" (env "SERVER")}} | ||
items: | ||
- name: health | ||
request: | ||
api: /health | ||
- name: toLowerWithoutParam | ||
request: | ||
api: /lower | ||
expect: | ||
statusCode: 400 | ||
- name: toLower | ||
request: | ||
api: /lower?text=Hello | ||
expect: | ||
body: hello |
Oops, something went wrong.