Skip to content
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6e78b2e
refactor: refactor atest frontend.
yuluo-yx May 4, 2024
fded85b
featL optimize
yuluo-yx May 7, 2024
6ce4a38
feat: optimize test pages
yuluo-yx May 8, 2024
f45dc74
Merge https://github.com/linuxsuren/api-testing into 0504-yuluo/front…
yuluo-yx May 10, 2024
f3b3a52
feat: optimize import order
yuluo-yx May 10, 2024
e3202f9
ui: optimize headercomponent style
yuluo-yx May 11, 2024
5fb6cda
optimize: optimize test pages
yuluo-yx May 21, 2024
1e41be2
optimize: optimize test pages
yuluo-yx May 29, 2024
80cf32e
optimize: optimize other pages
yuluo-yx May 30, 2024
2eaf313
optimize: optimize test pages
SamYSF May 30, 2024
62e1c83
Merge remote-tracking branch 'origin/master' into front-api-re
SamYSF May 31, 2024
6053be6
feat: add docs stie for api-testing
yuluo-yx Jun 1, 2024
9cd76e8
Merge remote-tracking branch 'upstream/master' into 0504-yuluo/front-…
LinuxSuRen Jun 1, 2024
bc3cbda
Merge pull request #4 from LinuxSuRen/merge-yuluo-front
yuluo-yx Jun 2, 2024
b467c86
fix: fix css style
yuluo-yx Jun 2, 2024
9bbca84
Merge branch '0601-yuluo/add-docs-site' of https://github.com/yuluo-y…
yuluo-yx Jun 2, 2024
bdf4c47
fix: fix error links
yuluo-yx Jun 2, 2024
14f574e
fix: fix error links
yuluo-yx Jun 2, 2024
3dfcfac
restore
yuluo-yx Jun 2, 2024
8891ea1
fix: fix ci
yuluo-yx Jun 2, 2024
ae9010d
fix
yuluo-yx Jun 2, 2024
6032a9d
fix: update style
yuluo-yx Jun 2, 2024
fd08a72
fix: fix side language switch
SamYSF Jun 2, 2024
54e571c
fix: fix test pages bugs
yuluo-yx Jun 2, 2024
8a79494
Merge branch '0504-yuluo/front-api-re' of https://github.com/yuluo-yx…
yuluo-yx Jun 2, 2024
de27839
fix: fix test pages request bugs
yuluo-yx Jun 2, 2024
f6b0749
fix: fix test pages bugs
yuluo-yx Jun 2, 2024
99ed4fe
fix
yuluo-yx Jun 2, 2024
f49cc9f
fix: code generator
yuluo-yx Jun 2, 2024
e69491d
fix
yuluo-yx Jun 2, 2024
f405096
fix: fix test pages bug
yuluo-yx Jun 3, 2024
601849a
fix
yuluo-yx Jun 3, 2024
e2cde85
fix
yuluo-yx Jun 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8

# 4 space indentation
[*.{py,proto,go,js,ts,json,vue}]
indent_style = space
indent_size = 4
7 changes: 4 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
Make sure you run the `make test` command before committing the pr.
Making sure that your local build is OK before committing will help you reduce debugging time
and make it easier for maintainers to review.

If you are committing pr for the first time,
please read the contributor's documentation: https://github.com/LinuxSuRen/api-testing/blob/master/CONTRIBUTION.md
-->

> We highly recommend you read [the contributor's documentation](https://github.com/LinuxSuRen/api-testing/blob/master/CONTRIBUTING.md) before starting the review process especially since this is your first contribution to this project.
>
> It was updated on 2024/5/27

**What type of PR is this?**
<!--
Your PR title should be descriptive, and generally start with type that contains a subsystem name with `()` if necessary
Expand Down
47 changes: 39 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
env:
IMG_TOOL: docker

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

jobs:
Test:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -39,8 +43,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make build
make copy
make build copy
sudo atest service install
sudo atest service restart
sudo atest service status
Expand Down Expand Up @@ -73,7 +76,7 @@ jobs:
# - name: Operator
# run: cd operator && make build

BuildImage:
E2E:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand All @@ -92,7 +95,7 @@ jobs:
fi
make helm-pkg
- name: Core Image
run: GOPROXY=direct IMG_TOOL=docker make build
run: GOPROXY=direct IMG_TOOL=docker TAG=master REGISTRY=ghcr.io make image
- name: Run e2e
env:
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }}
Expand All @@ -102,11 +105,11 @@ jobs:
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
make test-e2e
# - name: Operator Image
# run: cd operator && make docker-build
- name: Code Generator Test
run: cd e2e/code-generator && ./start.sh

BuildEmbedUI:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: ./tools/github-actions/setup-deps
Expand All @@ -118,8 +121,36 @@ jobs:
cache-dependency-path: console/atest-ui/package-lock.json
- name: Build
run: |
make build-embed-ui
make build-embed-ui copy
sudo atest service install
sudo atest service restart
- name: Test
run: make test-ui

BuildDesktop:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: ./tools/github-actions/setup-deps
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
# for fixing Error: Cannot find module 'appdmg'
- name: Install Python 3.11.4
uses: actions/setup-python@v4
with:
python-version: '3.11.4'
- name: Build Desktop on Windows
if: runner.os == 'Windows'
env:
BINARY: atest.exe
run: |
make desktop-package desktop-make
- name: Build Desktop
if: runner.os != 'Windows'
run: |
make desktop-package desktop-make desktop-test
2 changes: 1 addition & 1 deletion .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
push:
branches:
- master
- feat/mock-timer

jobs:
qodana:
runs-on: ubuntu-latest
if: github.actor == 'linuxsuren'
steps:
- uses: actions/checkout@v3
with:
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
REGISTRY: ghcr.io
REGISTRY_DOCKERHUB: docker.io
REGISTRY_ALIYUN: registry.aliyuncs.com
REGISTRY_TENCENT: ccr.ccs.tencentyun.com
IMAGE_NAME: ${{ github.repository }}

jobs:
Expand Down Expand Up @@ -85,6 +86,13 @@ jobs:
registry: ${{ env.REGISTRY_ALIYUN }}
username: ${{ secrets.REGISTRY_ALIYUN_USER }}
password: ${{ secrets.REGISTRY_ALIYUN_PUBLISH_SECRETS }}
- name: Log into registry ${{ env.REGISTRY_TENCENT }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY_TENCENT }}
username: 100002400732
password: ${{ secrets.REGISTRY_TENCENT_PUBLISH_SECRETS }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
Expand All @@ -93,6 +101,7 @@ jobs:
${{ env.REGISTRY }}/linuxsuren/api-testing
${{ env.REGISTRY_DOCKERHUB }}/${{ env.IMAGE_NAME }}
${{ env.REGISTRY_ALIYUN }}/${{ env.IMAGE_NAME }}
${{ env.REGISTRY_TENCENT }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
Expand All @@ -117,6 +126,90 @@ jobs:
fi
make helm-pkg helm-push

BuildDesktop:
strategy:
fail-fast: false
matrix:
# see https://github.com/actions/runner-images
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: ./tools/github-actions/setup-deps
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Build Server on Windows
if: runner.os == 'Windows'
env:
BINARY: atest.exe
run: |
make desktop-package
- name: Build Server
if: runner.os != 'Windows'
run: |
make desktop-package
# for fixing Error: Cannot find module 'appdmg'
- name: Install Python 3.11.4
uses: actions/setup-python@v4
with:
python-version: '3.11.4'
- name: Upload to Draft
env:
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
if: github.ref == 'refs/heads/master' && runner.os != 'Windows'
run: |
cd console/atest-desktop
export TAG=$(gh release list -L 1 | awk '{print $4}')
export TAG=${TAG#"v"}
jq '.version = env.TAG' package.json > package.json.new && mv package.json.new package.json
npm i
npm run publish
- name: Upload to Draft on Windows
env:
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
if: github.ref == 'refs/heads/master' && runner.os == 'Windows'
run: |
cd console/atest-desktop
$TAG = (gh release list -L 1).Split(' ')[0]
if ($TAG -like "v*") {
$TAG = $TAG -replace "^v", ""
}
Set-Content -Path "env:TAG" -Value "$TAG"
jq '.version = env.TAG' package.json > package.json.new
rm package.json
Rename-Item -Path package.json.new -NewName package.json
npm i
npm run publish
- name: Upload
env:
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
if: github.ref != 'refs/heads/master' && runner.os != 'Windows'
run: |
cd console/atest-desktop
export TAG=$(git describe --tags --abbrev=0)
export TAG=${TAG#"v"}
jq '.version = env.TAG' package.json > package.json.new && mv package.json.new package.json
npm i
npm run publish
- name: Upload on Windows
env:
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
if: github.ref != 'refs/heads/master' && runner.os == 'Windows'
run: |
cd console/atest-desktop
$TAG = git describe --tags --abbrev=0
if ($TAG -like "v*") {
$TAG = $TAG -replace "^v", ""
}
Set-Content -Path "env:TAG" -Value "$TAG"
jq '.version = env.TAG' package.json > package.json.new
rm package.json
Rename-Item -Path package.json.new -NewName package.json
npm i
npm run publish

# image-operator:
# runs-on: ubuntu-20.04
# steps:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ helm/*.tgz
helm/api-testing/*.tgz
oryxBuildBinary
/helm/api-testing/charts/
console/atest-desktop/out
console/atest-desktop/node_modules
console/atest-desktop/atest
console/atest-desktop/atest.exe
console/atest-desktop/coverage
1 change: 1 addition & 0 deletions CONTRIBUTING-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
| [Helm chart](https://helm.sh/) | The [Kubernetes](https://kubernetes.io/docs/home/) application package |
| [GitHub Actions](https://docs.github.com/en/actions) | The continuous integration |
| [make](https://www.gnu.org/software/make/) | The automated Build Tools |
| [Docs Guide](https://github.com/LinuxSuRen/api-testing.git) | 文档编写指南 |

## 设置开发环境

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ You might need to know the following tech before get started.
| [Helm chart](https://helm.sh/) | The [Kubernetes](https://kubernetes.io/docs/home/) application package |
| [GitHub Actions](https://docs.github.com/en/actions) | The continuous integration |
| [make](https://www.gnu.org/software/make/) | The automated Build Tools |
| [Docs Guide](https://github.com/LinuxSuRen/api-testing.git) | Documentation Guidelines |

## Setup development environment

Expand Down
Binary file added atest
Binary file not shown.
21 changes: 6 additions & 15 deletions cmd/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package cmd

import (
"errors"
"os"
"os/signal"
"syscall"
Expand All @@ -29,37 +28,29 @@ import (
type mockOption struct {
port int
prefix string
files []string
}

func createMockCmd() (c *cobra.Command) {
opt := &mockOption{}

c = &cobra.Command{
Use: "mock",
Short: "Start a mock server",
PreRunE: opt.preRunE,
RunE: opt.runE,
Use: "mock",
Short: "Start a mock server",
Args: cobra.ExactArgs(1),
RunE: opt.runE,
}

flags := c.Flags()
flags.IntVarP(&opt.port, "port", "", 6060, "The mock server port")
flags.StringVarP(&opt.prefix, "prefix", "", "/mock", "The mock server API prefix")
flags.StringSliceVarP(&opt.files, "files", "", nil, "The mock config files")
return
}

func (o *mockOption) preRunE(c *cobra.Command, args []string) (err error) {
if len(o.files) == 0 {
err = errors.New("at least one file is required")
}
return
}

func (o *mockOption) runE(c *cobra.Command, args []string) (err error) {
reader := mock.NewLocalFileReader(o.files[0])
reader := mock.NewLocalFileReader(args[0])
server := mock.NewInMemoryServer(o.port)

c.Println("start listen", o.port)
if err = server.Start(reader, o.prefix); err != nil {
return
}
Expand Down
13 changes: 9 additions & 4 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ See also https://github.com/LinuxSuRen/api-testing/tree/master/sample`,
flags.DurationVarP(&opt.duration, "duration", "", 0, "Running duration")
flags.DurationVarP(&opt.requestTimeout, "request-timeout", "", time.Minute, "Timeout for per request")
flags.BoolVarP(&opt.requestIgnoreError, "request-ignore-error", "", false, "Indicate if ignore the request error")
flags.StringVarP(&opt.report, "report", "", "", "The type of target report. Supported: markdown, md, html, json, discard, std, prometheus, http")
flags.StringVarP(&opt.report, "report", "", "", "The type of target report. Supported: markdown, md, html, json, discard, std, prometheus, http, grpc")
flags.StringVarP(&opt.reportFile, "report-file", "", "", "The file path of the report")
flags.BoolVarP(&opt.reportIgnore, "report-ignore", "", false, "Indicate if ignore the report output")
flags.StringVarP(&opt.reportTemplate, "report-template", "", "", "The template used to render the report")
Expand Down Expand Up @@ -166,15 +166,20 @@ func (o *runOption) preRunE(cmd *cobra.Command, args []string) (err error) {
case "http":
templateOption := runner.NewTemplateOption(o.reportTemplate, "json")
o.reportWriter = runner.NewHTTPResultWriter(http.MethodPost, o.reportDest, nil, templateOption)
case "grpc":
if o.reportDest == "" {
err = fmt.Errorf("report gRPC server url is required for prometheus report")
}
o.reportWriter = runner.NewGRPCResultWriter(o.context, o.reportDest)
default:
err = fmt.Errorf("not supported report type: '%s'", o.report)
}

if err == nil {
var swaggerAPI apispec.APIConverage
var swaggerAPI apispec.SwaggerAPI
if o.swaggerURL != "" {
if swaggerAPI, err = apispec.ParseURLToSwagger(o.swaggerURL); err == nil {
o.reportWriter.WithAPIConverage(swaggerAPI)
if swaggerAPI.Swagger, err = apispec.ParseURLToSwagger(o.swaggerURL); err == nil {
o.reportWriter.WithAPIConverage(&swaggerAPI)
}
}
}
Expand Down
Loading