Skip to content

Commit

Permalink
feat: get gRPC descriptor via server reflection (#210)
Browse files Browse the repository at this point in the history
Signed-off-by: Ink33 <[email protected]>
  • Loading branch information
Ink-33 authored Sep 6, 2023
1 parent c582610 commit acc8b26
Show file tree
Hide file tree
Showing 14 changed files with 920 additions and 555 deletions.
46 changes: 46 additions & 0 deletions .github/testing/grpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!api-testing
# yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-schema.json
# see also https://github.com/LinuxSuRen/api-testing
name: grpc-sample
api: 127.0.0.1:7070
spec:
grpc:
import:
- ./pkg/server
protofile: server.proto
items:
- name: GetVersion
request:
api: /server.Runner/GetVersion
- name: FunctionsQuery
request:
api: /server.Runner/FunctionsQuery
body: |
{
"name": "hello"
}
expect:
body: |
{
"data": [
{
"key": "hello",
"value": "func() string"
}
]
}
- name: FunctionsQueryStream
request:
api: /server.Runner/FunctionsQueryStream
body: |
[
{
"name": "hello"
},
{
"name": "title"
}
]
expect:
verify:
- "len(data) == 2"
44 changes: 44 additions & 0 deletions .github/testing/grpc_ref.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!api-testing
# yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-schema.json
# see also https://github.com/LinuxSuRen/api-testing
name: grpc-sample
api: 127.0.0.1:7070
spec:
grpc:
serverReflection: true
items:
- name: GetVersion
request:
api: /server.Runner/GetVersion
- name: FunctionsQuery
request:
api: /server.Runner/FunctionsQuery
body: |
{
"name": "hello"
}
expect:
body: |
{
"data": [
{
"key": "hello",
"value": "func() string"
}
]
}
- name: FunctionsQueryStream
request:
api: /server.Runner/FunctionsQueryStream
body: |
[
{
"name": "hello"
},
{
"name": "title"
}
]
expect:
verify:
- "len(data) == 2"
37 changes: 19 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
Test:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18.x
- uses: actions/[email protected]
- name: Unit Test
run: |
make test-all-backend test-operator
Expand All @@ -32,30 +32,30 @@ jobs:
bash <(curl -Ls https://coverage.codacy.com/get.sh) final
APITest:
permissions: write-all
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18.x
- uses: actions/[email protected]
- name: API Test
run: |
make build copy
sudo atest service install
sudo atest service restart
sudo atest service status
atest run -p .github/testing/core.yaml --request-ignore-error --report md --report-file .github/workflows/report.md
atest run -p sample/grpc-sample.yaml
atest run -p '.github/testing/*.yaml' --request-ignore-error --report md --report-file .github/workflows/report.md
sudo atest service status
atest convert -p .github/testing/core.yaml --converter jmeter -t sample.jmx
- name: Report API Test
uses: harupy/comment-on-pr@c0522c44600040927a120b9309b531e3cb6f8d48
uses: thollander/actions-comment-pull-request@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: report.md
filePath: .github/workflows/report.md
- name: Run JMeter Tests
uses: rbhadti94/[email protected]
with:
Expand All @@ -64,28 +64,29 @@ jobs:
Build:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18.x
- uses: actions/[email protected]
- name: Run GoReleaser
uses: goreleaser/[email protected]
uses: goreleaser/goreleaser-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
with:
github_token: ${{ secrets.GH_PUBLISH_SECRETS }}
version: v1.14.0
version: latest
args: release --skip-publish --rm-dist --snapshot
- name: Operator
run: cd operator && make build

BuildImage:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18.x
- uses: actions/[email protected]
- name: Core Image
run: make build-image
- name: Operator Image
Expand All @@ -94,16 +95,16 @@ jobs:
BuildEmbedUI:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18.x
- uses: actions/[email protected]
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
cache: "npm"
cache-dependency-path: console/atest-ui/package-lock.json
- name: Build
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- '*'
- "*"
branches:
- master

Expand All @@ -21,14 +21,14 @@ jobs:
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
cache: "npm"
cache-dependency-path: console/atest-ui/package-lock.json
- name: Run GoReleaser
uses: goreleaser/[email protected]
Expand All @@ -41,11 +41,11 @@ jobs:
Test:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.18.x
- uses: actions/[email protected]
- name: Unit Test
run: |
make test-all-backend test-operator
Expand Down
Loading

0 comments on commit acc8b26

Please sign in to comment.