Skip to content
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

feat: add binding testing and multiple bindings test data to compliance service #1150

Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
review changes
viacheslav-rostovtsev committed Jul 22, 2022

Verified

This commit was signed with the committer’s verified signature.
florianduros Florian Duros
commit d7554aa498edd33e011b1c508c624e5e5b9bb388
2 changes: 1 addition & 1 deletion cmd/gapic-showcase/endpoint_test.go
Original file line number Diff line number Diff line change
@@ -175,7 +175,7 @@ func TestRESTCalls(t *testing.T) {
log.Fatal(err)
}
if got, want := string(body), testCase.want; noSpace(got) != noSpace(want) {
t.Errorf("testcase %2d: body: got `%s`, want `%s`", idx, noSpace(got), noSpace(want))
t.Errorf("testcase %2d: body: got %q, want %q", idx, noSpace(got), noSpace(want))
t.Errorf(" request: %v", request)
}
jsonOptions.Restore()
18 changes: 9 additions & 9 deletions server/genrest/compliance.go
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ func (backend *RESTBackend) HandleRepeatDataBody(w http.ResponseWriter, r *http.
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/repeat:body")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/repeat:body")
response, err := backend.ComplianceServer.RepeatDataBody(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -160,7 +160,7 @@ func (backend *RESTBackend) HandleRepeatDataBodyInfo(w http.ResponseWriter, r *h
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/repeat:bodyinfo")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/repeat:bodyinfo")
response, err := backend.ComplianceServer.RepeatDataBodyInfo(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -217,7 +217,7 @@ func (backend *RESTBackend) HandleRepeatDataQuery(w http.ResponseWriter, r *http
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/repeat:query")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/repeat:query")
response, err := backend.ComplianceServer.RepeatDataQuery(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -279,7 +279,7 @@ func (backend *RESTBackend) HandleRepeatDataSimplePath(w http.ResponseWriter, r
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}/{info.f_kingdom}:simplepath")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}/{info.f_kingdom}:simplepath")
response, err := backend.ComplianceServer.RepeatDataSimplePath(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -341,7 +341,7 @@ func (backend *RESTBackend) HandleRepeatDataPathResource(w http.ResponseWriter,
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource")
response, err := backend.ComplianceServer.RepeatDataPathResource(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -403,7 +403,7 @@ func (backend *RESTBackend) HandleRepeatDataPathResource_1(w http.ResponseWriter
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/repeat/{info.f_child.f_string=first/*}/{info.f_string=second/*}/bool/{info.f_bool}:childfirstpathresource")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/repeat/{info.f_child.f_string=first/*}/{info.f_string=second/*}/bool/{info.f_bool}:childfirstpathresource")
response, err := backend.ComplianceServer.RepeatDataPathResource(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -465,7 +465,7 @@ func (backend *RESTBackend) HandleRepeatDataPathTrailingResource(w http.Response
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource")
response, err := backend.ComplianceServer.RepeatDataPathTrailingResource(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -535,7 +535,7 @@ func (backend *RESTBackend) HandleRepeatDataBodyPut(w http.ResponseWriter, r *ht
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/repeat:bodyput")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/repeat:bodyput")
response, err := backend.ComplianceServer.RepeatDataBodyPut(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -605,7 +605,7 @@ func (backend *RESTBackend) HandleRepeatDataBodyPatch(w http.ResponseWriter, r *
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/repeat:bodypatch")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/repeat:bodypatch")
response, err := backend.ComplianceServer.RepeatDataBodyPatch(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
12 changes: 6 additions & 6 deletions server/genrest/echo.go
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ func (backend *RESTBackend) HandleEcho(w http.ResponseWriter, r *http.Request) {
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/echo:echo")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/echo:echo")
response, err := backend.EchoServer.Echo(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -223,7 +223,7 @@ func (backend *RESTBackend) HandlePagedExpand(w http.ResponseWriter, r *http.Req
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/echo:pagedExpand")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/echo:pagedExpand")
response, err := backend.EchoServer.PagedExpand(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -293,7 +293,7 @@ func (backend *RESTBackend) HandlePagedExpandLegacy(w http.ResponseWriter, r *ht
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/echo:pagedExpandLegacy")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/echo:pagedExpandLegacy")
response, err := backend.EchoServer.PagedExpandLegacy(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -363,7 +363,7 @@ func (backend *RESTBackend) HandlePagedExpandLegacyMapped(w http.ResponseWriter,
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/echo:pagedExpandLegacyMapped")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/echo:pagedExpandLegacyMapped")
response, err := backend.EchoServer.PagedExpandLegacyMapped(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -433,7 +433,7 @@ func (backend *RESTBackend) HandleWait(w http.ResponseWriter, r *http.Request) {
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/echo:wait")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/echo:wait")
response, err := backend.EchoServer.Wait(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -503,7 +503,7 @@ func (backend *RESTBackend) HandleBlock(w http.ResponseWriter, r *http.Request)
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/echo:block")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/echo:block")
response, err := backend.EchoServer.Block(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
10 changes: 5 additions & 5 deletions server/genrest/identity.go
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ func (backend *RESTBackend) HandleCreateUser(w http.ResponseWriter, r *http.Requ
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/users")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/users")
response, err := backend.IdentityServer.CreateUser(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -143,7 +143,7 @@ func (backend *RESTBackend) HandleGetUser(w http.ResponseWriter, r *http.Request
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/{name=users/*}")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/{name=users/*}")
response, err := backend.IdentityServer.GetUser(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -213,7 +213,7 @@ func (backend *RESTBackend) HandleUpdateUser(w http.ResponseWriter, r *http.Requ
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/{user.name=users/*}")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/{user.name=users/*}")
response, err := backend.IdentityServer.UpdateUser(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -275,7 +275,7 @@ func (backend *RESTBackend) HandleDeleteUser(w http.ResponseWriter, r *http.Requ
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/{name=users/*}")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/{name=users/*}")
response, err := backend.IdentityServer.DeleteUser(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
@@ -332,7 +332,7 @@ func (backend *RESTBackend) HandleListUsers(w http.ResponseWriter, r *http.Reque
requestJSON, _ := marshaler.Marshal(request)
backend.StdLog.Printf(" request: %s", requestJSON)

ctx := context.WithValue(r.Context(), resttools.BindingURIKey("bindingUri"), "/v1beta1/users")
ctx := context.WithValue(r.Context(), resttools.BindingURIKey, "/v1beta1/users")
response, err := backend.IdentityServer.ListUsers(ctx, request)
if err != nil {
backend.ReportGRPCError(w, err)
Loading