diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e972d7f..d748044 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -67,6 +67,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3.0.0 + - name: Set output + id: vars + run: git describe --tags >> $GITHUB_OUTPUT - name: Setup Docker buildx uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf - name: Log into registry ${{ env.REGISTRY }} @@ -92,6 +95,7 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max + build-args: VERSION=${{ steps.vars.outputs.tag }} image-operator: runs-on: ubuntu-20.04 @@ -129,6 +133,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3.0.0 + - name: Set output + id: vars + run: git describe --tags >> $GITHUB_OUTPUT - name: Setup Docker buildx uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf - name: Log into registry ${{ env.REGISTRY_DOCKERHUB }} @@ -154,9 +161,7 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max - - name: Set output - id: vars - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + build-args: VERSION=${{ steps.vars.outputs.tag }} - name: Release Helm run: | echo ${{ secrets.DOCKER_HUB_PUBLISH_SECRETS }} | helm registry login docker.io -u linuxsuren --password-stdin diff --git a/Dockerfile b/Dockerfile index f79ca49..7208acf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,8 @@ COPY --from=ui /workspace/dist/assets/*.css cmd/data/index.css COPY --from=sk /usr/local/bin/skywalking-go-agent /usr/local/bin/skywalking-go-agent RUN GOPROXY=${GOPROXY} go mod download -RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -toolexec="skywalking-go-agent" -a -ldflags "-w -s -X github.com/linuxsuren/api-testing/pkg/version.version=${VERSION}" -o atest . +RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -toolexec="skywalking-go-agent" -a -ldflags "-w -s -X github.com/linuxsuren/api-testing/pkg/version.version=${VERSION}\ + -X github.com/linuxsuren/api-testing/pkg/version.date=$(date +%Y-%m-%d)" -o atest . RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -ldflags "-w -s" -o atest-collector extensions/collector/main.go RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -ldflags "-w -s" -o atest-store-orm extensions/store-orm/main.go RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -ldflags "-w -s" -o atest-store-s3 extensions/store-s3/main.go diff --git a/Makefile b/Makefile index 2b3615a..7f2bb8f 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,23 @@ -IMG_TOOL?=podman +IMG_TOOL?=docker BINARY?=atest -TOOLEXEC?=-toolexec="skywalking-go-agent" -GOPROXY?=https://goproxy.cn,direct +TOOLEXEC?= #-toolexec="skywalking-go-agent" +BUILD_FLAG?=-ldflags "-w -s -X github.com/linuxsuren/api-testing/pkg/version.version=$(shell git describe --tags) \ + -X github.com/linuxsuren/api-testing/pkg/version.date=$(shell date +%Y-%m-%d)" +GOPROXY?=direct HELM_VERSION?=v0.0.2 APP_VERSION?=v0.0.13 HELM_REPO?=docker.io/linuxsuren fmt: go fmt ./... - cd extensions/store-etcd && go fmt ./... - cd extensions/store-git && go fmt ./... - cd extensions/store-orm && go fmt ./... - cd extensions/store-s3 && go fmt ./... + cd extensions/store-etcd && go mod tidy && go fmt ./... + cd extensions/store-git && go mod tidy && go fmt ./... + cd extensions/store-orm && go mod tidy && go fmt ./... + cd extensions/store-s3 && go mod tidy && go fmt ./... build: mkdir -p bin rm -rf bin/atest - go build ${TOOLEXEC} -a -o bin/atest main.go + go build ${TOOLEXEC} -a ${BUILD_FLAG} -o bin/atest main.go build-ext: build-ext-git build-ext-orm build-ext-s3 build-ext-etcd build-ext-git: CGO_ENABLED=0 go build -ldflags "-w -s" -o bin/atest-store-git extensions/store-git/main.go diff --git a/cmd/root.go b/cmd/root.go index 1ed7060..a9e09f0 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -17,7 +17,7 @@ func NewRootCmd(execer fakeruntime.Execer, gRPCServer gRPCServer, Short: "API testing tool", } c.SetOut(os.Stdout) - c.Version = version.GetVersion() + c.Version = "\n" + version.GetDetailedVersion() c.AddCommand(createInitCommand(execer), createRunCommand(), createSampleCmd(), createServerCmd(execer, gRPCServer, httpServer), createJSONSchemaCmd(), diff --git a/console/atest-ui/src/App.vue b/console/atest-ui/src/App.vue index 549e389..f02f23f 100644 --- a/console/atest-ui/src/App.vue +++ b/console/atest-ui/src/App.vue @@ -42,6 +42,7 @@ const testSuite = ref('') const testSuiteKind = ref('') const handleNodeClick = (data: Tree) => { if (data.children) { + Cache.SetCurrentStore(data.store) viewName.value = 'testsuite' testSuite.value = data.label testSuiteKind.value = data.kind @@ -63,7 +64,7 @@ const handleNodeClick = (data: Tree) => { data.children = [] d.items.forEach((item: any) => { data.children?.push({ - id: data.label + item.name, + id: data.label, label: item.name, kind: data.kind, store: data.store, @@ -74,10 +75,10 @@ const handleNodeClick = (data: Tree) => { } }) } else { + Cache.SetCurrentStore(data.store) Cache.SetLastTestCaseLocation(data.parentID, data.id) testCaseName.value = data.label testSuite.value = data.parent - Cache.SetCurrentStore(data.store) testSuiteKind.value = data.kind viewName.value = 'testcase' } diff --git a/console/atest-ui/src/locales/en.json b/console/atest-ui/src/locales/en.json index 5323ce7..ca53dd3 100644 --- a/console/atest-ui/src/locales/en.json +++ b/console/atest-ui/src/locales/en.json @@ -25,7 +25,8 @@ "protoContent": "Proto Content", "protoFile": "Proto File", "protoImport": "Proto Import", - "param": "Parameter" + "param": "Parameter", + "refelction": "Refelction" }, "tip": { "filter": "Filter Keyword" diff --git a/console/atest-ui/src/views/TestCase.vue b/console/atest-ui/src/views/TestCase.vue index 99d2fa8..ed94f89 100644 --- a/console/atest-ui/src/views/TestCase.vue +++ b/console/atest-ui/src/views/TestCase.vue @@ -20,7 +20,7 @@ const props = defineProps({ const store = Cache.GetCurrentStore() const emit = defineEmits(['updated']) -let querySuggestedAPIs = NewSuggestedAPIsQuery(store.name!, props.suite!) +let querySuggestedAPIs = NewSuggestedAPIsQuery(Cache.GetCurrentStore().name!, props.suite!) const testResultActiveTab = ref(Cache.GetPreference().responseActiveTab) watch(testResultActiveTab, Cache.WatchResponseActiveTab) @@ -37,7 +37,7 @@ const sendRequest = async () => { const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, body: JSON.stringify({ suite: suite, @@ -105,7 +105,7 @@ function openParameterDialog() { const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, body: JSON.stringify({ name: props.suite @@ -132,7 +132,7 @@ function generateCode() { const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, body: JSON.stringify({ TestSuite: suite, @@ -234,7 +234,7 @@ function load() { const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, body: JSON.stringify({ suite: suite, @@ -311,7 +311,7 @@ function saveTestCase(tip: boolean = true) { const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, body: JSON.stringify(testCaseWithSuite.value) } @@ -338,7 +338,7 @@ function deleteTestCase() { const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, body: JSON.stringify({ suite: suite, @@ -489,7 +489,7 @@ const pupularHeaders = ref([] as Pair[]) const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, } fetch('/server.Runner/PopularHeaders', requestOptions) @@ -515,10 +515,10 @@ const queryPupularHeaders = (queryString: string, cb: (arg: any) => void) => {
{{ t('button.save') }} {{ t('button.save') }} {{ t('button.delete') }} {{ t('button.generateCode') }} diff --git a/console/atest-ui/src/views/TestSuite.vue b/console/atest-ui/src/views/TestSuite.vue index 2913c11..1989d3e 100644 --- a/console/atest-ui/src/views/TestSuite.vue +++ b/console/atest-ui/src/views/TestSuite.vue @@ -15,7 +15,7 @@ const props = defineProps({ }) const store = Cache.GetCurrentStore() const emit = defineEmits(['updated']) -let querySuggestedAPIs = NewSuggestedAPIsQuery(store.name, props.name!) +let querySuggestedAPIs = NewSuggestedAPIsQuery(Cache.GetCurrentStore().name, props.name!) const suite = ref({ name: '', @@ -26,11 +26,13 @@ const suite = ref({ url: '', rpc: { raw: '', - protofile: '' + protofile: '', + serverReflection: false } } } as Suite) function load() { + const store = Cache.GetCurrentStore() if (!props.name || store.name === "") return const requestOptions = { @@ -71,7 +73,7 @@ function save() { const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, body: JSON.stringify(suite.value) } @@ -109,7 +111,7 @@ const rules = reactive>({ function openNewTestCaseDialog() { dialogVisible.value = true - querySuggestedAPIs = NewSuggestedAPIsQuery(store.name!, props.name!) + querySuggestedAPIs = NewSuggestedAPIsQuery(Cache.GetCurrentStore().name!, props.name!) } const submitForm = async (formEl: FormInstance | undefined) => { @@ -121,7 +123,7 @@ const submitForm = async (formEl: FormInstance | undefined) => { const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, body: JSON.stringify({ suiteName: props.name, @@ -151,7 +153,7 @@ function del() { const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, body: JSON.stringify({ name: props.name @@ -175,7 +177,7 @@ function convert() { const requestOptions = { method: 'POST', headers: { - 'X-Store-Name': store.name + 'X-Store-Name': Cache.GetCurrentStore().name }, body: JSON.stringify({ Generator: 'jmeter', @@ -278,12 +280,18 @@ function paramChange() {
- {{ t('title.protoContent') }} - +
+ {{ t('title.refelction') }} + +
+
+ {{ t('title.protoContent') }} + +
{{ t('title.protoImport') }} @@ -295,8 +303,8 @@ function paramChange() {
- {{ t('button.save') }} - {{ t('button.save') }} + {{ t('button.save') }} + {{ t('button.save') }} {{ t('button.delete') }} {{ t('button.newtestcase') }} {{ t('button.export') }} diff --git a/e2e/test-suite-common.yaml b/e2e/test-suite-common.yaml index d94abf1..836388e 100644 --- a/e2e/test-suite-common.yaml +++ b/e2e/test-suite-common.yaml @@ -8,13 +8,20 @@ param: suiteName: "{{randAlpha 6}}" caseName: "{{randAlpha 6}}" store: "{{randAlpha 3}}" +<<<<<<< HEAD:e2e/test-suite-common.yaml server: | {{default "http://localhost:8080" (env "SERVER")}} +======= +>>>>>>> 1f91a9f (feat: support set a store as readonly (#269)):extensions/e2e/test-suite-common.yaml items: - name: CreateStore before: items: +<<<<<<< HEAD:e2e/test-suite-common.yaml - httpReady("{{.param.server}}/healthz", 2400) +======= + - httpReady("http://localhost:8080/healthz", 2400) +>>>>>>> 1f91a9f (feat: support set a store as readonly (#269)):extensions/e2e/test-suite-common.yaml request: api: /CreateStore method: POST diff --git a/extensions/store-etcd/go.mod b/extensions/store-etcd/go.mod index 37d48c2..49a1a6d 100644 --- a/extensions/store-etcd/go.mod +++ b/extensions/store-etcd/go.mod @@ -42,7 +42,7 @@ require ( github.com/iancoleman/strcase v0.2.0 // indirect github.com/imdario/mergo v0.3.11 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect - github.com/jhump/protoreflect v1.9.0 // indirect + github.com/jhump/protoreflect v1.15.3 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.15.9 // indirect github.com/lestrrat-go/strftime v1.0.6 // indirect diff --git a/extensions/store-etcd/go.sum b/extensions/store-etcd/go.sum index bf2ae27..f15344e 100644 --- a/extensions/store-etcd/go.sum +++ b/extensions/store-etcd/go.sum @@ -789,7 +789,6 @@ github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57Q github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w= @@ -815,8 +814,8 @@ github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= -github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= @@ -871,7 +870,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/panjf2000/ants/v2 v2.4.6 h1:drmj9mcygn2gawZ155dRbo+NfXEfAssjZNU1qoIb4gQ= github.com/panjf2000/ants/v2 v2.4.6/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= @@ -1321,10 +1319,8 @@ golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWc golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -1581,7 +1577,6 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/extensions/store-git/go.mod b/extensions/store-git/go.mod index d2aea25..4a795b4 100644 --- a/extensions/store-git/go.mod +++ b/extensions/store-git/go.mod @@ -19,7 +19,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/iancoleman/strcase v0.2.0 // indirect - github.com/jhump/protoreflect v1.9.0 // indirect + github.com/jhump/protoreflect v1.15.3 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.15.9 // indirect github.com/lestrrat-go/strftime v1.0.6 // indirect @@ -40,7 +40,6 @@ require ( go.uber.org/automaxprocs v1.3.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.24.0 // indirect - google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e // indirect google.golang.org/grpc v1.57.0 // indirect gopkg.in/ini.v1 v1.66.6 // indirect trpc.group/trpc-go/fbs v1.0.0 // indirect diff --git a/extensions/store-git/go.sum b/extensions/store-git/go.sum index a4614b3..c39b591 100644 --- a/extensions/store-git/go.sum +++ b/extensions/store-git/go.sum @@ -185,7 +185,6 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/h2non/gock v1.2.0 h1:K6ol8rfrRkUOefooBC8elXoaNGYkpp7y2qcxGG6BzUE= @@ -210,8 +209,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= -github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= @@ -255,7 +254,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/panjf2000/ants/v2 v2.4.6 h1:drmj9mcygn2gawZ155dRbo+NfXEfAssjZNU1qoIb4gQ= github.com/panjf2000/ants/v2 v2.4.6/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= @@ -578,9 +576,7 @@ golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWc golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -662,7 +658,6 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= @@ -695,7 +690,6 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/extensions/store-orm/go.mod b/extensions/store-orm/go.mod index 3e53ae5..8b37b96 100644 --- a/extensions/store-orm/go.mod +++ b/extensions/store-orm/go.mod @@ -38,7 +38,7 @@ require ( github.com/iancoleman/strcase v0.2.0 // indirect github.com/imdario/mergo v0.3.11 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect - github.com/jhump/protoreflect v1.9.0 // indirect + github.com/jhump/protoreflect v1.15.3 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -89,7 +89,6 @@ require ( golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/grpc v1.57.0 // indirect diff --git a/extensions/store-orm/go.sum b/extensions/store-orm/go.sum index ee11fd0..b32d580 100644 --- a/extensions/store-orm/go.sum +++ b/extensions/store-orm/go.sum @@ -160,7 +160,6 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/h2non/gock v1.2.0 h1:K6ol8rfrRkUOefooBC8elXoaNGYkpp7y2qcxGG6BzUE= @@ -183,8 +182,8 @@ github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= -github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= @@ -227,7 +226,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/panjf2000/ants/v2 v2.4.6 h1:drmj9mcygn2gawZ155dRbo+NfXEfAssjZNU1qoIb4gQ= github.com/panjf2000/ants/v2 v2.4.6/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= @@ -523,9 +521,7 @@ golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWc golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -604,7 +600,6 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= @@ -637,7 +632,6 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/extensions/store-s3/go.mod b/extensions/store-s3/go.mod index 03114e3..b310421 100644 --- a/extensions/store-s3/go.mod +++ b/extensions/store-s3/go.mod @@ -7,7 +7,6 @@ require ( github.com/linuxsuren/api-testing v0.0.14 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.4 - google.golang.org/grpc v1.59.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -38,7 +37,7 @@ require ( github.com/iancoleman/strcase v0.2.0 // indirect github.com/imdario/mergo v0.3.11 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jhump/protoreflect v1.9.0 // indirect + github.com/jhump/protoreflect v1.15.3 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.15.9 // indirect @@ -88,9 +87,9 @@ require ( golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.66.6 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/extensions/store-s3/go.sum b/extensions/store-s3/go.sum index 0ae123d..b0c5a4d 100644 --- a/extensions/store-s3/go.sum +++ b/extensions/store-s3/go.sum @@ -160,7 +160,6 @@ github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/h2non/gock v1.2.0 h1:K6ol8rfrRkUOefooBC8elXoaNGYkpp7y2qcxGG6BzUE= @@ -183,8 +182,8 @@ github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= -github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -207,8 +206,6 @@ github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2t github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is= github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205AhTIGQQ= github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw= -github.com/linuxsuren/api-testing v0.0.14 h1:uRWpAflh11n3k9raW248IoMXUlb7M458sEfluRDG7ZU= -github.com/linuxsuren/api-testing v0.0.14/go.mod h1:Jj57EHv0HcJxwbJ4lxZCiDjcC7/vtWdyqOWK2Be53VE= github.com/linuxsuren/go-fake-runtime v0.0.1 h1:ByXNvKgn5g+qnvS4KJIq/OP/fA3qCMRGxwlxsU6Weh8= github.com/linuxsuren/go-fake-runtime v0.0.1/go.mod h1:zmh6J78hSnWZo68faMA2eKOdaEp8eFbERHi3ZB9xHCQ= github.com/linuxsuren/unstructured v0.0.1 h1:ilUA8MUYbR6l9ebo/YPV2bKqlf62bzQursDSE+j00iU= @@ -229,7 +226,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/panjf2000/ants/v2 v2.4.6 h1:drmj9mcygn2gawZ155dRbo+NfXEfAssjZNU1qoIb4gQ= github.com/panjf2000/ants/v2 v2.4.6/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= @@ -528,9 +524,7 @@ golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWc golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -609,7 +603,6 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= @@ -642,7 +635,6 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/go.mod b/go.mod index 4e9c034..ece189b 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 github.com/h2non/gock v1.2.0 github.com/invopop/jsonschema v0.7.0 + github.com/jhump/protoreflect v1.15.3 github.com/linuxsuren/go-fake-runtime v0.0.1 github.com/linuxsuren/unstructured v0.0.1 github.com/prometheus/client_golang v1.16.0 @@ -58,7 +59,6 @@ require ( github.com/iancoleman/strcase v0.2.0 // indirect github.com/imdario/mergo v0.3.11 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect - github.com/jhump/protoreflect v1.9.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.15.9 // indirect github.com/lestrrat-go/strftime v1.0.6 // indirect @@ -100,7 +100,6 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/ini.v1 v1.66.6 // indirect diff --git a/go.sum b/go.sum index 3ac463d..ab1c829 100644 --- a/go.sum +++ b/go.sum @@ -171,7 +171,6 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/h2non/gock v1.2.0 h1:K6ol8rfrRkUOefooBC8elXoaNGYkpp7y2qcxGG6BzUE= @@ -211,8 +210,8 @@ github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7P github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/jsonschema v0.7.0 h1:2vgQcBz1n256N+FpX3Jq7Y17AjYt46Ig3zIWyy770So= github.com/invopop/jsonschema v0.7.0/go.mod h1:O9uiLokuu0+MGFlyiaqtWxwqJm41/+8Nj0lD7A36YH0= -github.com/jhump/protoreflect v1.9.0 h1:npqHz788dryJiR/l6K/RUQAyh2SwV91+d1dnh4RjO9w= -github.com/jhump/protoreflect v1.9.0/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= @@ -256,7 +255,6 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/panjf2000/ants/v2 v2.4.6 h1:drmj9mcygn2gawZ155dRbo+NfXEfAssjZNU1qoIb4gQ= github.com/panjf2000/ants/v2 v2.4.6/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= @@ -561,9 +559,7 @@ golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWc golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -642,7 +638,6 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= @@ -675,7 +670,6 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/go.work.sum b/go.work.sum index c4e0d1c..fa9f766 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,4 +1,5 @@ cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= +cloud.google.com/go v0.110.6/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= cloud.google.com/go/accessapproval v1.7.1/go.mod h1:JYczztsHRMK7NTXb6Xw+dwbs/WnOJxbo/2mTI+Kgg68= cloud.google.com/go/accesscontextmanager v1.8.1/go.mod h1:JFJHfvuaTC+++1iL1coPiG1eu5D24db2wXCDWDjIrxo= @@ -49,6 +50,7 @@ cloud.google.com/go/edgecontainer v1.1.1/go.mod h1:O5bYcS//7MELQZs3+7mabRqoWQhXC cloud.google.com/go/essentialcontacts v1.6.2/go.mod h1:T2tB6tX+TRak7i88Fb2N9Ok3PvY3UNbUsMag9/BARh4= cloud.google.com/go/eventarc v1.13.0/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= cloud.google.com/go/filestore v1.7.1/go.mod h1:y10jsorq40JJnjR/lQ8AfFbbcGlw3g+Dp8oN7i7FjV4= +cloud.google.com/go/firestore v1.11.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= cloud.google.com/go/firestore v1.12.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= cloud.google.com/go/functions v1.15.1/go.mod h1:P5yNWUTkyU+LvW/S9O6V+V423VZooALQlqoXdoPz5AE= cloud.google.com/go/gkebackup v1.3.0/go.mod h1:vUDOu++N0U5qs4IhG1pcOnD1Mac79xWy6GoBFlWCWBU= @@ -199,6 +201,10 @@ github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= +github.com/jhump/gopoet v0.0.0-20190322174617-17282ff210b3/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI= +github.com/jhump/gopoet v0.1.0/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI= +github.com/jhump/goprotoc v0.5.0/go.mod h1:VrbvcYrQOrTi3i0Vf+m+oqQWk9l72mjkJCYo7UvLHRQ= +github.com/jhump/protoreflect v1.11.0/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E= github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -272,6 +278,7 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -281,15 +288,21 @@ golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= +google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= +google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= k8s.io/code-generator v0.26.0/go.mod h1:OMoJ5Dqx1wgaQzKgc+ZWaZPfGjdRq/Y3WubFrZmeI3I= diff --git a/pkg/runner/grpc.go b/pkg/runner/grpc.go index 6c2c7e9..74b42ff 100644 --- a/pkg/runner/grpc.go +++ b/pkg/runner/grpc.go @@ -27,6 +27,7 @@ import ( "errors" "fmt" "io" + "log" "net/http" "net/url" "os" @@ -36,6 +37,9 @@ import ( "time" "github.com/bufbuild/protocompile" + "github.com/bufbuild/protocompile/linker" + "github.com/jhump/protoreflect/desc" + "github.com/jhump/protoreflect/grpcreflect" "github.com/linuxsuren/api-testing/pkg/apispec" "github.com/linuxsuren/api-testing/pkg/compare" "github.com/linuxsuren/api-testing/pkg/testing" @@ -45,6 +49,7 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/reflection/grpc_reflection_v1" + "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protodesc" @@ -52,7 +57,6 @@ import ( "google.golang.org/protobuf/reflect/protoregistry" "google.golang.org/protobuf/types/descriptorpb" "google.golang.org/protobuf/types/dynamicpb" - "trpc.group/trpc-go/trpc-go/log" ) type gRPCTestCaseRunner struct { @@ -105,19 +109,8 @@ func (r *gRPCTestCaseRunner) RunTestCase(testcase *testing.TestCase, dataContext r.log.Info("start to send request to %s\n", testcase.Request.API) var conn *grpc.ClientConn - if r.Secure == nil || r.Secure.Insecure { - conn, err = grpc.Dial(getHost(testcase.Request.API, r.host), grpc.WithTransportCredentials(insecure.NewCredentials())) - } else { - var cred credentials.TransportCredentials - cred, err = credentials.NewClientTLSFromFile(r.Secure.CertFile, r.Secure.ServerName) - if err != nil { - return nil, err - } - conn, err = grpc.Dial(getHost(testcase.Request.API, r.host), grpc.WithTransportCredentials(cred)) - } - - if err != nil { - return nil, err + if conn, err = r.getConnection(getHost(testcase.Request.API, r.host)); err != nil { + return } defer conn.Close() @@ -155,6 +148,84 @@ func (r *gRPCTestCaseRunner) RunTestCase(testcase *testing.TestCase, dataContext return } +func (r *gRPCTestCaseRunner) getConnection(host string) (conn *grpc.ClientConn, err error) { + if r.Secure == nil || r.Secure.Insecure { + conn, err = grpc.Dial(host, grpc.WithTransportCredentials(insecure.NewCredentials())) + } else { + var cred credentials.TransportCredentials + cred, err = credentials.NewClientTLSFromFile(r.Secure.CertFile, r.Secure.ServerName) + if err == nil { + conn, err = grpc.Dial(host, grpc.WithTransportCredentials(cred)) + } + } + return +} + +func (r *gRPCTestCaseRunner) GetSuggestedAPIs(suite *testing.TestSuite, api string) (result []*testing.TestCase, err error) { + if suite.Spec.RPC.ServerReflection { + var conn *grpc.ClientConn + if conn, err = r.getConnection(suite.API); err != nil { + return + } + + stub := grpc_reflection_v1alpha.NewServerReflectionClient(conn) + client := grpcreflect.NewClientV1Alpha(context.Background(), stub) + + var allSvcs []string + allSvcs, err = client.ListServices() + if err != nil { + return + } + for _, svc := range allSvcs { + var fd *desc.FileDescriptor + if fd, err = client.FileContainingSymbol(svc); err != nil { + return + } + svcs := fd.GetServices() + + for _, item := range svcs { + for _, fdb := range item.GetMethods() { + result = append(result, &testing.TestCase{ + Name: fdb.GetName(), + Request: testing.Request{ + API: fmt.Sprintf("/%s/%s", svc, fdb.GetName()), + }, + }) + } + } + } + return + } + + var linkerFiles linker.Files + linkerFiles, err = compileProto(context.Background(), r) + if err != nil { + return + } + + for _, f := range linkerFiles { + for j := 0; j < f.Services().Len(); j++ { + svc := f.Services().Get(j) + + methodCount := svc.Methods().Len() + for m := 0; m < methodCount; m++ { + method := svc.Methods().Get(m) + methodName := string(method.Name()) + api := "/" + string(method.FullName()) + api = strings.ReplaceAll(api, "."+methodName, "/"+methodName) + + result = append(result, &testing.TestCase{ + Name: string(methodName), + Request: testing.Request{ + API: api, + }, + }) + } + } + } + return +} + func (r *gRPCTestCaseRunner) GetResponseRecord() SimpleResponse { return r.response } @@ -268,14 +339,13 @@ func getMethodDescriptor(ctx context.Context, r *gRPCTestCaseRunner, testcase *t return nil, protoregistry.NotFound } -func getByProto(ctx context.Context, r *gRPCTestCaseRunner, fullName protoreflect.FullName) (protoreflect.Descriptor, error) { - if r.proto.ProtoSet != "" { - return getByProtoSet(ctx, r, fullName) - } - - protoFile, importPath, parentProtoDir, err := util.LoadProtoFiles(r.proto.ProtoFile) +func compileProto(ctx context.Context, r *gRPCTestCaseRunner) (fileLinker linker.Files, err error) { + var protoFile string + var importPath []string + var parentProtoDir string + protoFile, importPath, parentProtoDir, err = util.LoadProtoFiles(r.proto.ProtoFile) if err != nil { - return nil, err + return } if len(importPath) == 0 { @@ -293,10 +363,10 @@ func getByProto(ctx context.Context, r *gRPCTestCaseRunner, fullName protoreflec var protoLibrary map[string]string if protoLibrary, err = apispec.GetProtoFiles(); err != nil { - return nil, err + return } - log.Infof("proto import files: %v", importPath) + log.Println("proto import files", importPath) compiler := protocompile.Compiler{ Resolver: protocompile.WithStandardImports( &protocompile.SourceResolver{ @@ -313,22 +383,31 @@ func getByProto(ctx context.Context, r *gRPCTestCaseRunner, fullName protoreflec // save the proto to a temp file if the raw content given if r.proto.Raw != "" { - f, err := os.CreateTemp(os.TempDir(), "proto") + var f *os.File + f, err = os.CreateTemp(os.TempDir(), "proto") if err != nil { err = fmt.Errorf("failed to create temp file when saving proto content: %v", err) - return nil, err + return } defer os.Remove(f.Name()) _, err = f.WriteString(r.proto.Raw) if err != nil { err = fmt.Errorf("failed to write proto content to file %q: %v", f.Name(), err) - return nil, err + return } protoFile = f.Name() } - linker, err := compiler.Compile(ctx, protoFile) + return compiler.Compile(ctx, protoFile) +} + +func getByProto(ctx context.Context, r *gRPCTestCaseRunner, fullName protoreflect.FullName) (protoreflect.Descriptor, error) { + if r.proto.ProtoSet != "" { + return getByProtoSet(ctx, r, fullName) + } + + linker, err := compileProto(ctx, r) if err != nil { return nil, err } @@ -544,7 +623,7 @@ func loadProtoFiles(protoFile string) (targetProtoFile string, importPath []stri return } - log.Infof("start to download proto file %q\n", protoFile) + log.Println("start to download proto file", protoFile) resp, err := util.GetDefaultCachedHTTPClient().Get(protoFile) if err != nil { return diff --git a/pkg/runner/grpc_test.go b/pkg/runner/grpc_test.go index fd46d6b..9861442 100644 --- a/pkg/runner/grpc_test.go +++ b/pkg/runner/grpc_test.go @@ -26,6 +26,7 @@ import ( "log" "math/rand" "net" + "net/http" "os" "sync" "testing" @@ -594,19 +595,70 @@ func TestAPINameMatch(t *testing.T) { "match full qualified name long", ) - qn, err = splitFullQualifiedName("127.0.0.1:7070//server.Runner/GetVersion") + _, err = splitFullQualifiedName("127.0.0.1:7070//server.Runner/GetVersion") assert.NotNil(t, err, "unexpect leading character", ) - qn, err = splitFullQualifiedName("127.0.0.1:7070/server.Runner/GetVersion/") + _, err = splitFullQualifiedName("127.0.0.1:7070/server.Runner/GetVersion/") assert.NotNil(t, err, "unexpect trailing character", ) } +func TestGRPCGetSuggestedAPIs(t *testing.T) { + protoFile := "grpc_test/test.proto" + + t.Run("normal", func(t *testing.T) { + runner := NewGRPCTestCaseRunner("", atest.RPCDesc{ + ProtoFile: protoFile, + }) + result, err := runner.GetSuggestedAPIs(&atest.TestSuite{ + Spec: atest.APISpec{ + RPC: &atest.RPCDesc{ + ProtoFile: protoFile, + }, + }, + }, "") + assert.NoError(t, err, err) + assert.NotEmpty(t, result) + assert.Equal(t, "/grpctest.Main/Unary", result[0].Request.API) + }) + + t.Run("not found proto file", func(t *testing.T) { + runner := NewGRPCTestCaseRunner("", atest.RPCDesc{ + ProtoFile: "fake", + }) + _, err := runner.GetSuggestedAPIs(&atest.TestSuite{ + Spec: atest.APISpec{ + RPC: &atest.RPCDesc{ + ProtoFile: "fake", + }, + }, + }, "") + assert.Error(t, err, err) + }) + + t.Run("invalid refelction API", func(t *testing.T) { + defer gock.Off() + gock.New(urlFoo).Get("/").Reply(http.StatusNotFound) + + desc := atest.RPCDesc{ + ServerReflection: true, + } + runner := NewGRPCTestCaseRunner("", desc) + _, err := runner.GetSuggestedAPIs(&atest.TestSuite{ + API: urlFoo, + Spec: atest.APISpec{ + RPC: &desc, + }, + }, "") + assert.Error(t, err, err) + }) +} + // getJSONOrCache can store the JSON string of value. // // Let key be nil represent not using cache. @@ -622,6 +674,3 @@ func getJSONOrCache(key any, value any) (msg string) { } return } - -//go:embed grpc_test/test.proto -var protoFileForTest string diff --git a/pkg/runner/http.go b/pkg/runner/http.go index c1d8a46..942a513 100644 --- a/pkg/runner/http.go +++ b/pkg/runner/http.go @@ -14,6 +14,7 @@ import ( "github.com/andreyvit/diff" "github.com/antonmedv/expr" "github.com/antonmedv/expr/vm" + "github.com/linuxsuren/api-testing/pkg/apispec" "github.com/linuxsuren/api-testing/pkg/render" "github.com/linuxsuren/api-testing/pkg/testing" "github.com/linuxsuren/api-testing/pkg/util" @@ -231,6 +232,29 @@ func (r *simpleTestCaseRunner) RunTestCase(testcase *testing.TestCase, dataConte return } +func (r *simpleTestCaseRunner) GetSuggestedAPIs(suite *testing.TestSuite, api string) (result []*testing.TestCase, err error) { + if suite.Spec.URL == "" || suite.Spec.Kind != "swagger" { + return + } + + var swaggerAPI *apispec.Swagger + if swaggerAPI, err = apispec.ParseURLToSwagger(suite.Spec.URL); err == nil && swaggerAPI != nil { + result = []*testing.TestCase{} + for api, item := range swaggerAPI.Paths { + for method, oper := range item { + result = append(result, &testing.TestCase{ + Name: oper.OperationId, + Request: testing.Request{ + API: api, + Method: strings.ToUpper(method), + }, + }) + } + } + } + return +} + func (r *simpleTestCaseRunner) withResponseRecord(resp *http.Response) (responseBodyData []byte, err error) { responseBodyData, err = io.ReadAll(resp.Body) r.simpleResponse = SimpleResponse{ diff --git a/pkg/runner/http_test.go b/pkg/runner/http_test.go index 702e1bb..71b422a 100644 --- a/pkg/runner/http_test.go +++ b/pkg/runner/http_test.go @@ -30,6 +30,7 @@ import ( "errors" "net/http" "os" + "strings" "testing" _ "embed" @@ -243,123 +244,121 @@ func TestTestCase(t *testing.T) { assert.NotNil(t, err) assert.Contains(t, err.Error(), "not found field") }, - }, - { - name: "verify failed", - testCase: &atest.TestCase{ - Request: atest.Request{ - API: urlFoo, - }, - Expect: atest.Response{ - Verify: []string{ - "len(data.items) > 0", - }, - }, + }, { + name: "verify failed", + testCase: &atest.TestCase{ + Request: atest.Request{ + API: urlFoo, }, - prepare: defaultPrepare, - verify: func(t *testing.T, output interface{}, err error) { - if assert.NotNil(t, err) { - assert.Contains(t, err.Error(), "failed to verify") - } + Expect: atest.Response{ + Verify: []string{ + "len(data.items) > 0", + }, }, }, - { - name: "failed to compile", - testCase: &atest.TestCase{ - Request: fooRequst, - Expect: atest.Response{ - Verify: []string{ - `println("12")`, - }, + prepare: defaultPrepare, + verify: func(t *testing.T, output interface{}, err error) { + if assert.NotNil(t, err) { + assert.Contains(t, err.Error(), "failed to verify") + } + }, + }, { + name: "failed to compile", + testCase: &atest.TestCase{ + Request: fooRequst, + Expect: atest.Response{ + Verify: []string{ + `println("12")`, }, }, - prepare: defaultPrepare, - verify: func(t *testing.T, output interface{}, err error) { - assert.NotNil(t, err) - assert.Contains(t, err.Error(), "unknown name println") - }, - }, { - name: "failed to compile", - testCase: &atest.TestCase{ - Request: fooRequst, - Expect: atest.Response{ - Verify: []string{ - `1 + 1`, - }, + }, + prepare: defaultPrepare, + verify: func(t *testing.T, output interface{}, err error) { + assert.NotNil(t, err) + assert.Contains(t, err.Error(), "unknown name println") + }, + }, { + name: "failed to compile", + testCase: &atest.TestCase{ + Request: fooRequst, + Expect: atest.Response{ + Verify: []string{ + `1 + 1`, }, }, - prepare: defaultPrepare, - verify: func(t *testing.T, output interface{}, err error) { - assert.NotNil(t, err) - assert.Contains(t, err.Error(), "expected bool, but got int") + }, + prepare: defaultPrepare, + verify: func(t *testing.T, output interface{}, err error) { + assert.NotNil(t, err) + assert.Contains(t, err.Error(), "expected bool, but got int") + }, + }, { + name: "wrong API format", + testCase: &atest.TestCase{ + Request: atest.Request{ + API: "ssh://localhost/foo", + Method: "fake,fake", }, - }, { - name: "wrong API format", - testCase: &atest.TestCase{ - Request: atest.Request{ - API: "ssh://localhost/foo", - Method: "fake,fake", + }, + verify: func(t *testing.T, output interface{}, err error) { + assert.NotNil(t, err) + assert.Contains(t, err.Error(), "invalid method") + }, + }, { + name: "failed to render API", + testCase: &atest.TestCase{ + Request: atest.Request{ + API: "http://localhost/foo/{{.abc}", + }, + }, + verify: func(t *testing.T, output interface{}, err error) { + assert.NotNil(t, err) + assert.Contains(t, err.Error(), "template: api:1:") + }, + }, { + name: "multipart form request", + testCase: &atest.TestCase{ + Request: atest.Request{ + API: urlFoo, + Method: http.MethodPost, + Header: map[string]string{ + util.ContentType: "multipart/form-data", }, + Form: defaultForm, }, - verify: func(t *testing.T, output interface{}, err error) { - assert.NotNil(t, err) - assert.Contains(t, err.Error(), "invalid method") - }, - }, { - name: "failed to render API", - testCase: &atest.TestCase{ - Request: atest.Request{ - API: "http://localhost/foo/{{.abc}", + }, + prepare: defaultPostPrepare, + verify: noError, + }, { + name: "normal form request", + testCase: &atest.TestCase{ + Request: atest.Request{ + API: urlFoo, + Method: http.MethodPost, + Header: map[string]string{ + util.ContentType: "application/x-www-form-urlencoded", }, + Form: defaultForm, }, - verify: func(t *testing.T, output interface{}, err error) { - assert.NotNil(t, err) - assert.Contains(t, err.Error(), "template: api:1:") + }, + prepare: defaultPostPrepare, + verify: noError, + }, { + name: "body is a template", + testCase: &atest.TestCase{ + Request: atest.Request{ + API: urlFoo, + Method: http.MethodPost, + Body: `{"name":"{{lower "HELLO"}}"}`, }, - }, { - name: "multipart form request", - testCase: &atest.TestCase{ - Request: atest.Request{ - API: urlFoo, - Method: http.MethodPost, - Header: map[string]string{ - util.ContentType: "multipart/form-data", - }, - Form: defaultForm, - }, - }, - prepare: defaultPostPrepare, - verify: noError, - }, { - name: "normal form request", - testCase: &atest.TestCase{ - Request: atest.Request{ - API: urlFoo, - Method: http.MethodPost, - Header: map[string]string{ - util.ContentType: "application/x-www-form-urlencoded", - }, - Form: defaultForm, - }, - }, - prepare: defaultPostPrepare, - verify: noError, - }, { - name: "body is a template", - testCase: &atest.TestCase{ - Request: atest.Request{ - API: urlFoo, - Method: http.MethodPost, - Body: `{"name":"{{lower "HELLO"}}"}`, - }, - }, - prepare: func() { - gock.New(urlLocalhost). - Post("/foo").BodyString(`{"name":"hello"}`). - Reply(http.StatusOK).BodyString(`{}`) - }, - verify: noError, - }} + }, + prepare: func() { + gock.New(urlLocalhost). + Post("/foo").BodyString(`{"name":"hello"}`). + Reply(http.StatusOK).BodyString(`{}`) + }, + verify: noError, + }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { defer gock.Clean() @@ -512,6 +511,28 @@ func TestBodyFiledsVerify(t *testing.T) { } } +func TestGetSuggestedAPIs(t *testing.T) { + runner := NewSimpleTestCaseRunner() + // not a swagger + result, err := runner.GetSuggestedAPIs(&atest.TestSuite{}, "") + assert.NoError(t, err, err) + assert.Empty(t, result) + + // swagger + gock.Off() + gock.New(urlFoo).Get("swagger.json").Reply(http.StatusOK).File("testdata/swagger.json") + result, err = runner.GetSuggestedAPIs(&atest.TestSuite{ + Spec: atest.APISpec{ + Kind: "swagger", + URL: urlFoo + "/swagger.json", + }, + }, "") + assert.NoError(t, err, err) + assert.NotEmpty(t, result) + method := result[0].Request.Method + assert.Equal(t, strings.ToUpper(method), method) +} + const defaultSchemaForTest = `{"properties": { "name": {"type": "string"}, "age": {"type": "integer"} diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index 5f98727..0f6a1a0 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -12,6 +12,7 @@ import ( // TestCaseRunner represents a test case runner type TestCaseRunner interface { RunTestCase(testcase *testing.TestCase, dataContext interface{}, ctx context.Context) (output interface{}, err error) + GetSuggestedAPIs(suite *testing.TestSuite, api string) ([]*testing.TestCase, error) WithSecure(secure *testing.Secure) WithOutputWriter(io.Writer) WithWriteLevel(level string) diff --git a/pkg/runner/testdata/swagger.json b/pkg/runner/testdata/swagger.json new file mode 100644 index 0000000..391c3a8 --- /dev/null +++ b/pkg/runner/testdata/swagger.json @@ -0,0 +1,34 @@ +{ + "swagger": "2.0", + "info": { + "description": "sample", + "title": "sample", + "version": "1.0.0" + }, + "paths": { + "/api/v1/users": { + "get": { + "summary": "summary", + "operationId": "getUsers" + }, + "post": { + "summary": "summary", + "operationId": "createUser" + } + }, + "/api/v1/users/{user}": { + "get": { + "summary": "summary", + "operationId": "getUser" + }, + "delete": { + "summary": "summary", + "operationId": "deleteUser" + }, + "put": { + "summary": "summary", + "operationId": "updateUser" + } + } + } +} diff --git a/pkg/runner/trpc.go b/pkg/runner/trpc.go index b1cb214..6c96a84 100644 --- a/pkg/runner/trpc.go +++ b/pkg/runner/trpc.go @@ -117,6 +117,11 @@ func (r *tRPCTestCaseRunner) RunTestCase(testcase *testing.TestCase, dataContext return } +func (r *tRPCTestCaseRunner) GetSuggestedAPIs(suite *testing.TestSuite, api string) (result []*testing.TestCase, err error) { + // TODO need to implement + return +} + func (r *tRPCTestCaseRunner) GetResponseRecord() SimpleResponse { return r.response } diff --git a/pkg/server/convert.go b/pkg/server/convert.go index 67dc7ee..baacd9e 100644 --- a/pkg/server/convert.go +++ b/pkg/server/convert.go @@ -123,9 +123,11 @@ func ToNormalSuite(suite *TestSuite) (result *testing.TestSuite) { } if suite.Spec.Rpc != nil { result.Spec.RPC = &testing.RPCDesc{ - Raw: suite.Spec.Rpc.Raw, - ProtoFile: suite.Spec.Rpc.Protofile, - ImportPath: suite.Spec.Rpc.Import, + Raw: suite.Spec.Rpc.Raw, + ProtoFile: suite.Spec.Rpc.Protofile, + ProtoSet: suite.Spec.Rpc.Protoset, + ImportPath: suite.Spec.Rpc.Import, + ServerReflection: suite.Spec.Rpc.ServerReflection, } } } diff --git a/pkg/server/remote_server.go b/pkg/server/remote_server.go index b1dafc7..ae02d30 100644 --- a/pkg/server/remote_server.go +++ b/pkg/server/remote_server.go @@ -40,7 +40,6 @@ import ( "log" - "github.com/linuxsuren/api-testing/pkg/apispec" "github.com/linuxsuren/api-testing/pkg/generator" "github.com/linuxsuren/api-testing/pkg/render" "github.com/linuxsuren/api-testing/pkg/runner" @@ -364,6 +363,7 @@ func (s *server) GetTestSuite(ctx context.Context, in *TestSuiteIdentity) (resul if suite, _, err = loader.GetSuite(in.Name); err == nil && suite != nil { result = ToGRPCSuite(suite) } + fmt.Println(suite, "==", result, "==", in.Name) return } @@ -635,23 +635,13 @@ func (s *server) GetSuggestedAPIs(ctx context.Context, in *TestSuiteIdentity) (r return } - if suite.Spec.URL == "" { - return - } - log.Println("Finding APIs from", in.Name, "with loader", reflect.TypeOf(loader)) - var swaggerAPI *apispec.Swagger - if swaggerAPI, err = apispec.ParseURLToSwagger(suite.Spec.URL); err == nil && swaggerAPI != nil { - for api, item := range swaggerAPI.Paths { - for method, oper := range item { - reply.Data = append(reply.Data, &TestCase{ - Name: oper.OperationId, - Request: &Request{ - Api: api, - Method: strings.ToUpper(method), - }, - }) - } + + suiteRunner := runner.GetTestSuiteRunner(suite) + var result []*testing.TestCase + if result, err = suiteRunner.GetSuggestedAPIs(suite, in.Api); err == nil && result != nil { + for i := range result { + reply.Data = append(reply.Data, ToGRPCTestCase(*result[i])) } } return diff --git a/pkg/server/remote_server_test.go b/pkg/server/remote_server_test.go index dd8cd98..9cd55dc 100644 --- a/pkg/server/remote_server_test.go +++ b/pkg/server/remote_server_test.go @@ -34,6 +34,7 @@ import ( "sync" "sync/atomic" "testing" + "time" _ "embed" @@ -51,6 +52,7 @@ const ( func TestRemoteServer(t *testing.T) { ctx := context.Background() + defer gock.Off() loader := atesting.NewFileWriter("") loader.Put("testdata/simple.yaml") @@ -522,12 +524,15 @@ func TestGetSuggestedAPIs(t *testing.T) { }) t.Run("with swagger URL, not accessed", func(t *testing.T) { + gock.Off() + name := fmt.Sprintf("fake-%d", time.Now().Second()) _, err := server.CreateTestSuite(ctx, &TestSuiteIdentity{ - Name: "fake", + Name: name, }) + assert.NoError(t, err) _, err = server.UpdateTestSuite(ctx, &TestSuite{ - Name: "fake", + Name: name, Spec: &APISpec{ Url: urlFoo + "/v2", }, @@ -536,11 +541,12 @@ func TestGetSuggestedAPIs(t *testing.T) { gock.New(urlFoo).Get("/v2").Reply(500) - _, err = server.GetSuggestedAPIs(ctx, &TestSuiteIdentity{Name: "fake"}) + _, err = server.GetSuggestedAPIs(ctx, &TestSuiteIdentity{Name: name}) assert.NoError(t, err) }) t.Run("normal", func(t *testing.T) { + gock.Off() _, err := server.CreateTestSuite(ctx, &TestSuiteIdentity{ Name: "fake-1", }) @@ -549,7 +555,8 @@ func TestGetSuggestedAPIs(t *testing.T) { _, err = server.UpdateTestSuite(ctx, &TestSuite{ Name: "fake-1", Spec: &APISpec{ - Url: urlFoo + "/v1", + Kind: "swagger", + Url: urlFoo + "/v1", }, }) assert.NoError(t, err) @@ -694,7 +701,7 @@ func TestCodeGenerator(t *testing.T) { Kind: "postman", Url: urlFoo, }) - assert.Error(t, err) + assert.Error(t, err, err) assert.False(t, result.Success) }) } diff --git a/pkg/server/testdata/postman.json b/pkg/server/testdata/postman.json index eede993..2832236 100644 --- a/pkg/server/testdata/postman.json +++ b/pkg/server/testdata/postman.json @@ -1,7 +1,7 @@ { "info": { "_postman_id": "0da1f6bf-fdbb-46a5-ac46-873564e2259c", - "name": "New Collection", + "name": "NewCollection", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "6795120", "_collection_link": "https://www.postman.com/ks-devops/workspace/kubesphere-devops/collection/6795120-0da1f6bf-fdbb-46a5-ac46-873564e2259c?action=share&creator=6795120&source=collection_link" diff --git a/pkg/testing/loader_file.go b/pkg/testing/loader_file.go index 0a89b2e..031a7cb 100644 --- a/pkg/testing/loader_file.go +++ b/pkg/testing/loader_file.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "log" "net/http" "net/url" "os" @@ -144,13 +145,13 @@ func (l *fileLoader) ListTestSuite() (suites []TestSuite, err error) { var data []byte var loadErr error if data, loadErr = loadData(target); err != nil { - fmt.Println("failed to load data", loadErr) + log.Println("failed to load data", loadErr) continue } var testSuite *TestSuite if testSuite, loadErr = Parse(data); loadErr != nil { - fmt.Println("failed to parse data", loadErr) + log.Println("failed to parse data", loadErr, "from", target) continue } suites = append(suites, *testSuite) @@ -171,6 +172,11 @@ func (l *fileLoader) GetTestSuite(name string, full bool) (suite TestSuite, err } func (l *fileLoader) CreateSuite(name, api string) (err error) { + if name == "" { + err = fmt.Errorf("name is required") + return + } + var absPath string var suite *TestSuite if suite, absPath, err = l.GetSuite(name); err != nil { diff --git a/pkg/version/constants.go b/pkg/version/constants.go index f76ab61..df5bae3 100644 --- a/pkg/version/constants.go +++ b/pkg/version/constants.go @@ -1,10 +1,18 @@ // Package version provides the version access of this app package version +import "fmt" + // should be injected during the build process var version string +var date string // GetVersion returns the version func GetVersion() string { return version } + +func GetDetailedVersion() string { + return fmt.Sprintf(`Version: %s +Date: %s`, version, date) +}