-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests, fix lint, staticchecks and other issues
- Loading branch information
1 parent
80c69d8
commit 1aa9d68
Showing
14 changed files
with
83 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
examples/example-gateway/build/services/example-gateway/mock-service/mock_init.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
examples/example-gateway/build/services/example-gateway/module/dependencies.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
examples/example-gateway/build/services/example-gateway/module/init.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
examples/example-gateway/build/services/example-gateway/service.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
examples/example-gateway/endpoints/serverless/serverless_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package serverless | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"io/ioutil" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
endpointServerless "github.com/uber/zanzibar/examples/example-gateway/build/gen-code/endpoints/serverless/serverless" | ||
ms "github.com/uber/zanzibar/examples/example-gateway/build/services/example-gateway/mock-service" | ||
) | ||
|
||
func TestServerlessEndpointCall(t *testing.T) { | ||
ms := ms.MustCreateTestService(t) | ||
ms.Start() | ||
defer ms.Stop() | ||
|
||
var a = "Test" | ||
endpointRequest := &endpointServerless.Serverless_Beta_Args{ | ||
Request: &endpointServerless.Request{ | ||
FirstName: &a, | ||
}, | ||
} | ||
rawBody, _ := endpointRequest.MarshalJSON() | ||
res, err := ms.MakeHTTPRequest( | ||
"POST", "/serverless/post-request", nil, bytes.NewReader(rawBody), | ||
) | ||
if !assert.NoError(t, err, "got http error") { | ||
return | ||
} | ||
|
||
assert.Equal(t, "200 OK", res.Status) | ||
respBytes, _ := ioutil.ReadAll(res.Body) | ||
assert.Equal(t, string("{\"firstName\":\"Test\"}"), string(respBytes)) | ||
fmt.Println(res.Body) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ dependencies: | |
- tchannel/panic | ||
- tchannel/quux | ||
- withexceptions | ||
- serverless |
This file was deleted.
Oops, something went wrong.