Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2022-01-13 01:18:21 +03:00
parent fb21516a5c
commit 11da5b59db
6 changed files with 304 additions and 219 deletions

View File

@ -46,6 +46,10 @@ func (s *testClientStream) Close() error {
return s.stream.Close()
}
func (s *testClientStream) CloseSend() error {
return s.stream.CloseSend()
}
func (s *testClientStream) Context() context.Context {
return s.stream.Context()
}

8
go.mod
View File

@ -13,7 +13,7 @@ require (
go.unistack.org/micro-broker-kgo/v3 v3.8.2
go.unistack.org/micro-broker-segmentio/v3 v3.8.0
go.unistack.org/micro-client-grpc/v3 v3.8.1
go.unistack.org/micro-client-http/v3 v3.8.3
go.unistack.org/micro-client-http/v3 v3.8.4
go.unistack.org/micro-codec-grpc/v3 v3.8.1
go.unistack.org/micro-codec-json/v3 v3.8.0
go.unistack.org/micro-codec-jsonpb/v3 v3.8.1
@ -35,10 +35,10 @@ require (
go.unistack.org/micro-wrapper-sql/v3 v3.0.1
go.unistack.org/micro-wrapper-trace-opentracing/v3 v3.8.0
go.unistack.org/micro/v3 v3.8.14
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/net v0.0.0-20220111093109-d55c255bac03 // indirect
golang.org/x/sys v0.0.0-20220111092808-5a964db01320 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb // indirect
google.golang.org/genproto v0.0.0-20220111164026-67b88f271998 // indirect
google.golang.org/grpc v1.43.0
google.golang.org/protobuf v1.27.1
modernc.org/sqlite v1.14.4

16
go.sum
View File

@ -390,8 +390,8 @@ go.unistack.org/micro-broker-segmentio/v3 v3.8.0 h1:Nm9BaS4eD6kuewHRGmUd/QFbdv4F
go.unistack.org/micro-broker-segmentio/v3 v3.8.0/go.mod h1:Q3mavh0ZoNRO6mw31USvE760lDWB1nQHWiE64F6s8rs=
go.unistack.org/micro-client-grpc/v3 v3.8.1 h1:fJKTR3YICl5sse17vJWJUnKlf8fELjxgMWWVlt52ew8=
go.unistack.org/micro-client-grpc/v3 v3.8.1/go.mod h1:1nxWfDbEn3FDodgh0CyHKnhHMoVd0F6HeCTpnGuX/QI=
go.unistack.org/micro-client-http/v3 v3.8.3 h1:1ixsGztisvdCANmwilNQ/UW15usdHz8QbiK00pP1I1g=
go.unistack.org/micro-client-http/v3 v3.8.3/go.mod h1:ACeZ/cfYkawSshdWCmo3Kc/PhgjoijdObGN2WMVkQPU=
go.unistack.org/micro-client-http/v3 v3.8.4 h1:XJPdp5AIXbl7MXO1qOgSMMtW1Qufg2H9tVBf3d+md+U=
go.unistack.org/micro-client-http/v3 v3.8.4/go.mod h1:J5EsA/EC5Fll8JrXCESNAQ3tPwPKR1cJg9OrPH7q2BM=
go.unistack.org/micro-codec-grpc/v3 v3.8.1 h1:vZrR07L8NKziG1dtzCBKoooaHpV3oP2c7rh93ClbUGI=
go.unistack.org/micro-codec-grpc/v3 v3.8.1/go.mod h1:RawS1ObPRsjsdvDXrGcLNnTexOHdU9yRZbF4QhWkRWw=
go.unistack.org/micro-codec-json/v3 v3.8.0 h1:sQ6xdHaNUCxCiUakGaV1t8lbX1rGWlgnF/HbsXyhkGg=
@ -485,8 +485,8 @@ golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM=
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220111093109-d55c255bac03 h1:0FB83qp0AzVJm+0wcIlauAjJ+tNdh7jLuacRYCIVv7s=
golang.org/x/net v0.0.0-20220111093109-d55c255bac03/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -533,8 +533,8 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220111092808-5a964db01320 h1:0jf+tOCoZ3LyutmCOWpVni1chK4VfFLhRsDK7MhqGRY=
golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@ -570,8 +570,8 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20210729151513-df9385d47c1b/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb h1:ZrsicilzPCS/Xr8qtBZZLpy4P9TYXAfl49ctG1/5tgw=
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220111164026-67b88f271998 h1:g/x+MYjJYDEP3OBCYYmwIbt4x6k3gryb+ohyOR7PXfI=
google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=

View File

@ -1,81 +1,131 @@
{
"openapi": "3.0.3",
"info": {
"title": "test title",
"description": "test desc",
"version": "0.0.5"
"openapi": "3.0.3",
"info": {
"title": "test title",
"description": "test desc",
"version": "0.0.5"
},
"servers": [
"servers": [
{
"url": "{proto}://{sub}.example.com/v1",
"description": "server",
"variables": {
"additionalProperties": [
"url": "{proto}://{sub}.example.com/v1",
"description": "server",
"variables": {
"additionalProperties": [
{
"name": "proto",
"value": {
"enum": [
"name": "proto",
"value": {
"enum": [
"http",
"https"
],
"default": "http",
"description": "protocols"
"default": "http",
"description": "protocols"
}
},
{
"name": "sub",
"value": {
"enum": [
"name": "sub",
"value": {
"enum": [
"test",
"prod"
],
"default": "test",
"description": "subdomain"
"default": "test",
"description": "subdomain"
}
}
]
}
},
{
"url": "https://other.example.com/v1",
"description": "other test server"
"url": "https://other.example.com/v1",
"description": "other test server"
}
],
"paths": {
"path": [
"paths": {
"path": [
{
"name": "/aml",
"value": {
"post": {
"operationId": "TestService_KzAmlRs",
"parameters": [
"name": "/aml",
"value": {
"post": {
"tags": [
"TestService"
],
"operationId": "TestService_KzAmlRs",
"parameters": [
{
"parameter": {
"name": "kzAmlNewOnlineRs",
"in": "query",
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "kzAmlNewOnlineRs.rquid",
"in": "query",
"schema": {
"schema": {
"type": "string"
}
}
}
},
{
"parameter": {
"name": "kzAmlNewOnlineRs.rqtm",
"in": "query",
"schema": {
"schema": {
"type": "string"
}
}
}
},
{
"parameter": {
"name": "kzAmlNewOnlineRs.status.status_code",
"in": "query",
"schema": {
"schema": {
"type": "integer",
"format": "int64"
}
}
}
},
{
"parameter": {
"name": "kzAmlNewOnlineRs.terr_status",
"in": "query",
"schema": {
"schema": {
"type": "integer",
"format": "int64"
}
}
}
},
{
"parameter": {
"name": "kzAmlNewOnlineRs.aml_status",
"in": "query",
"schema": {
"schema": {
"type": "integer",
"format": "int64"
}
}
}
}
],
"responses": {
"responseOrReference": [
"responses": {
"responseOrReference": [
{
"name": "200",
"value": {
"response": {
"description": "OK",
"content": {
"additionalProperties": [
"name": "200",
"value": {
"response": {
"description": "OK",
"content": {
"additionalProperties": [
{
"name": "application/json",
"value": {
"schema": {
"reference": {
"Ref": "#/components/schemas/ResponseAml"
"name": "application/json",
"value": {
"schema": {
"reference": {
"Ref": "#/components/schemas/ResponseAml"
}
}
}
@ -91,60 +141,64 @@
}
},
{
"name": "/users/image/upload",
"value": {
"post": {
"operationId": "TestService_UploadFile",
"parameters": [
"name": "/users/image/upload",
"value": {
"post": {
"tags": [
"TestService"
],
"operationId": "TestService_UploadFile",
"parameters": [
{
"parameter": {
"name": "image",
"in": "query",
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "image",
"in": "query",
"schema": {
"schema": {
"type": "string",
"format": "bytes"
}
}
}
},
{
"parameter": {
"name": "file_name",
"in": "query",
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "file_name",
"in": "query",
"schema": {
"schema": {
"type": "string"
}
}
}
},
{
"parameter": {
"name": "doc_type",
"in": "query",
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "doc_type",
"in": "query",
"schema": {
"schema": {
"type": "string"
}
}
}
}
],
"responses": {
"responseOrReference": [
"responses": {
"responseOrReference": [
{
"name": "200",
"value": {
"response": {
"description": "OK",
"content": {
"additionalProperties": [
"name": "200",
"value": {
"response": {
"description": "OK",
"content": {
"additionalProperties": [
{
"name": "application/json",
"value": {
"schema": {
"reference": {
"Ref": "#/components/schemas/ResponseImage"
"name": "application/json",
"value": {
"schema": {
"reference": {
"Ref": "#/components/schemas/ResponseImage"
}
}
}
@ -160,62 +214,76 @@
}
},
{
"name": "/users/test",
"value": {
"get": {
"operationId": "TestEndpoint",
"parameters": [
"name": "/users/test",
"value": {
"get": {
"tags": [
"TestService"
],
"operationId": "TestEndpoint",
"parameters": [
{
"parameter": {
"name": "client_uid",
"in": "header",
"required": true,
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "client_uid",
"in": "header",
"required": true,
"schema": {
"schema": {
"type": "string"
}
}
}
},
{
"parameter": {
"name": "csrftoken",
"in": "cookie",
"required": true,
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "csrftoken",
"in": "cookie",
"required": true,
"schema": {
"schema": {
"type": "string"
}
}
}
},
{
"parameter": {
"name": "id",
"in": "query",
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "id",
"in": "query",
"schema": {
"schema": {
"type": "string"
}
}
}
},
{
"parameter": {
"name": "client_uid",
"in": "query",
"schema": {
"schema": {
"type": "string"
}
}
}
}
],
"responses": {
"responseOrReference": [
"responses": {
"responseOrReference": [
{
"name": "200",
"value": {
"response": {
"description": "OK",
"content": {
"additionalProperties": [
"name": "200",
"value": {
"response": {
"description": "OK",
"content": {
"additionalProperties": [
{
"name": "application/json",
"value": {
"schema": {
"reference": {
"Ref": "#/components/schemas/Response"
"name": "application/json",
"value": {
"schema": {
"reference": {
"Ref": "#/components/schemas/Response"
}
}
}
@ -231,49 +299,53 @@
}
},
{
"name": "/users/{id}",
"value": {
"get": {
"operationId": "TestService_UserByID",
"parameters": [
"name": "/users/{id}",
"value": {
"get": {
"tags": [
"TestService"
],
"operationId": "TestService_UserByID",
"parameters": [
{
"parameter": {
"name": "id",
"in": "query",
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "id",
"in": "path",
"required": true,
"schema": {
"schema": {
"type": "string"
}
}
}
},
{
"parameter": {
"name": "client_uid",
"in": "query",
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "client_uid",
"in": "query",
"schema": {
"schema": {
"type": "string"
}
}
}
}
],
"responses": {
"responseOrReference": [
"responses": {
"responseOrReference": [
{
"name": "200",
"value": {
"response": {
"description": "OK",
"content": {
"additionalProperties": [
"name": "200",
"value": {
"response": {
"description": "OK",
"content": {
"additionalProperties": [
{
"name": "application/json",
"value": {
"schema": {
"reference": {
"Ref": "#/components/schemas/Response"
"name": "application/json",
"value": {
"schema": {
"reference": {
"Ref": "#/components/schemas/Response"
}
}
}
@ -289,46 +361,50 @@
}
},
{
"name": "/users/{id}/image",
"value": {
"get": {
"operationId": "TestService_UserImageByID",
"parameters": [
"name": "/users/{id}/image",
"value": {
"get": {
"tags": [
"TestService"
],
"operationId": "TestService_UserImageByID",
"parameters": [
{
"parameter": {
"name": "id",
"in": "query",
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "id",
"in": "path",
"required": true,
"schema": {
"schema": {
"type": "string"
}
}
}
},
{
"parameter": {
"name": "client_uid",
"in": "query",
"schema": {
"schema": {
"type": "string"
"parameter": {
"name": "client_uid",
"in": "query",
"schema": {
"schema": {
"type": "string"
}
}
}
}
],
"responses": {
"responseOrReference": [
"responses": {
"responseOrReference": [
{
"name": "200",
"value": {
"response": {
"description": "OK",
"content": {
"additionalProperties": [
"name": "200",
"value": {
"response": {
"description": "OK",
"content": {
"additionalProperties": [
{
"name": "application/octet-stream",
"value": {}
"name": "application/octet-stream",
"value": {}
}
]
}
@ -342,20 +418,20 @@
}
]
},
"components": {
"schemas": {
"additionalProperties": [
"components": {
"schemas": {
"additionalProperties": [
{
"name": "Response",
"value": {
"schema": {
"properties": {
"additionalProperties": [
"name": "Response",
"value": {
"schema": {
"properties": {
"additionalProperties": [
{
"name": "encoded_id",
"value": {
"schema": {
"type": "string"
"name": "encoded_id",
"value": {
"schema": {
"type": "string"
}
}
}
@ -365,16 +441,16 @@
}
},
{
"name": "ResponseAml",
"value": {
"schema": {
"properties": {
"additionalProperties": [
"name": "ResponseAml",
"value": {
"schema": {
"properties": {
"additionalProperties": [
{
"name": "resp",
"value": {
"schema": {
"type": "string"
"name": "resp",
"value": {
"schema": {
"type": "string"
}
}
}
@ -384,14 +460,19 @@
}
},
{
"name": "ResponseImage",
"value": {
"schema": {
"properties": {}
"name": "ResponseImage",
"value": {
"schema": {
"properties": {}
}
}
}
]
}
}
},
"tags": [
{
"name": "TestService"
}
]
}

View File

@ -30,8 +30,8 @@ func (c *testServiceClient) TestEndpoint(ctx context.Context, req *Request, opts
v3.Path("/users/test"),
)
opts = append(opts,
v3.Cookie("csrftoken", "true"),
v3.Header("client_uid", "true"),
v3.Cookie("csrftoken", "true"),
)
rsp := &Response{}
err := c.c.Call(ctx, c.c.NewRequest(c.name, "TestService.TestEndpoint", req), rsp, opts...)

View File

@ -160,8 +160,8 @@ func (h *testServer) Call(ctx context.Context, req *CallReq, rsp *CallRsp) error
ctx, cancel = context.WithTimeout(ctx, time.Second*5)
defer cancel()
v31.FillRequest(ctx, req,
v31.Header("Clientid", "true"),
v31.Cookie("Csrftoken", "true"),
v31.Header("Clientid", "true"),
)
return h.TestServer.Call(ctx, req, rsp)
}