Skip to content

feat: add trpc protocol support #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion .github/testing/grpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name: grpc-sample
api: 127.0.0.1:7070
spec:
grpc:
rpc:
import:
- ./pkg/server
protofile: server.proto
Expand Down
2 changes: 1 addition & 1 deletion .github/testing/grpc_descriptor_set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name: grpc-sample
api: 127.0.0.1:7070
spec:
grpc:
rpc:
protoset: .github/testing/server.pb
items:
- name: GetVersion
Expand Down
2 changes: 1 addition & 1 deletion .github/testing/grpc_ref.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name: grpc-sample
api: 127.0.0.1:7070
spec:
grpc:
rpc:
serverReflection: true
items:
- name: GetVersion
Expand Down
22 changes: 22 additions & 0 deletions .github/testing/trpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!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: trpc-sample
api: ip://127.0.0.1:8000
spec:
kind: trpc
rpc:
import:
- ./bin
protofile: ./bin/helloworld.proto
items:
- name: Hello
request:
api: Hello
body: |
{
"msg": "atest"
}
expect:
verify:
- data.msg == "Hello atest!"
2 changes: 1 addition & 1 deletion CONTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ docker run -p 8080:8080 -e SW_OAP_ADDRESS=http://localhost:12800 -e SW_ZIPKIN_AD
make build

export SW_AGENT_NAME=atest
export SW_AGENT_REPORTER_GRPC_BACKEND_SERVICE=172.11.0.6:32591
export SW_AGENT_REPORTER_GRPC_BACKEND_SERVICE=172.11.0.6:30689
export SW_AGENT_PLUGIN_CONFIG_HTTP_SERVER_COLLECT_PARAMETERS=true
export SW_AGENT_METER_COLLECT_INTERVAL=3
export SW_AGENT_LOG_TYPE=std
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ This is a API testing tool.

## Features

* Supportted protocols: HTTP, gRPC, tRPC
* Multiple test report formats: Markdown, HTML, PDF, Stdout
* Support converting to [JMeter](https://jmeter.apache.org/) files
* Response Body fields equation check or [eval](https://expr.medv.io/)
* Verify the Kubernetes resources
* Validate the response body with [JSON schema](https://json-schema.org/)
* Pre and post handle with the API request
* Output reference between TestCase
* Run in server mode, and provide the [gRPC](pkg/server/server.proto) and HTTP endpoint
* [VS Code extension](https://github.com/LinuxSuRen/vscode-api-testing) support
* Multiple storage backends supported(Local, ORM Database, S3, Git, etc)
* [HTTP API record](extensions/collector)
* Install in mutiple use cases(CLI, Container, Native-Service, Operator, etc)
* Install in mutiple use cases(CLI, Container, Native-Service, Operator, Helm, etc)
* Monitoring integration with Prometheus, Skywalking

## Get started
Expand Down
6 changes: 4 additions & 2 deletions docs/api-testing-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
"type": "string",
"enum": [
"openapi",
"swagger"
"swagger",
"grpc",
"trpc"
]
},
"url": {
Expand All @@ -57,7 +59,7 @@
"http"
]
},
"grpc": {
"rpc": {
"type": "object",
"additionalProperties": false,
"properties": {
Expand Down
4 changes: 2 additions & 2 deletions docs/grpc-manual-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

```yaml
spec:
grpc:
rpc:
serverReflection: true
```

`grpc`字段一共有五个子字段
`rpc`字段一共有五个子字段

| 字段名 | 类型 | 是否可选 |
| ---------------- | -------- | -------- |
Expand Down
4 changes: 2 additions & 2 deletions docs/grpc-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ To create a gRPC testsuite based on service reflection, just add the following c

```yaml
spec:
grpc:
rpc:
serverReflection: true
```

Field `grpc` has five subfields in total:
Field `rpc` has five subfields in total:

| Name | Type | Optional |
| ---------------- | -------- | -------- |
Expand Down
12 changes: 7 additions & 5 deletions docs/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ You could install `api-testing` via Helm chart:

```shell
helm install atest oci://docker.io/linuxsuren/api-testing \
--version v0.0.1-helm \
--version v0.0.2-helm \
--set service.type=NodePort
```

or upgrade it:

```shell
helm upgrade atest oci://docker.io/surenpi/api-testing \
--version v0.0.1-helm \
--version v0.0.2-helm \
--set image.tag=master \
--set replicaCount=3
```
Expand All @@ -19,8 +19,10 @@ helm upgrade atest oci://docker.io/surenpi/api-testing \

```shell
helm install atest oci://docker.io/linuxsuren/api-testing \
--version v0.0.1-helm \
--set skywalking.endpoint.http=http://skywalking-skywalking-helm-oap.skywalking.svc:12800
--version v0.0.2-helm \
--set image.tag=master \
--set service.type=NodePort \
--set service.nodePort=30154 \
--set skywalking.endpoint.http=http://skywalking-skywalking-helm-oap.skywalking.svc:12800 \
--set skywalking.endpoint.grpc=skywalking-skywalking-helm-oap.skywalking.svc:11800
--set service.type=NodePort
```
26 changes: 25 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,43 @@ require (
)

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cucumber/gherkin-go/v19 v19.0.3 // indirect
github.com/cucumber/messages-go/v16 v16.0.1 // indirect
github.com/dave/dst v0.27.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gofrs/uuid v4.2.0+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/flatbuffers v2.0.0+incompatible // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-memdb v1.3.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lestrrat-go/strftime v1.0.6 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/panjf2000/ants/v2 v2.4.6 // indirect
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -61,12 +75,18 @@ require (
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.43.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/automaxprocs v1.3.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
Expand All @@ -75,4 +95,8 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
skywalking.apache.org/repo/goapi v0.0.0-20230314034821-0c5a44bb767a // indirect
trpc.group/trpc-go/tnet v1.0.0 // indirect
trpc.group/trpc-go/trpc-cmdline v1.0.5 // indirect
trpc.group/trpc-go/trpc-go v1.0.1 // indirect
trpc.group/trpc/trpc-protocol/pb/go/trpc v1.0.0 // indirect
)
Loading