generated from keploy/template
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add sample app for grpc client mocking
Signed-off-by: Sarthak160 <[email protected]>
- Loading branch information
1 parent
3bce0bd
commit 0405baf
Showing
15 changed files
with
849 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# gRPC & HTTP Server Setup with Keploy | ||
|
||
This guide explains how to set up and run the gRPC and HTTP servers using Keploy to capture and test the HTTP calls. | ||
|
||
## Steps to Run | ||
|
||
### 1. Start the gRPC Server | ||
|
||
Open a terminal and navigate to the gRPC server directory: | ||
|
||
```bash | ||
cd grpc/grpc-server | ||
``` | ||
|
||
Run the gRPC server: | ||
|
||
```bash | ||
go run server.go | ||
``` | ||
|
||
### 2. Start the HTTP Server in Record Mode | ||
|
||
Open another terminal and navigate to the HTTP server directory: | ||
|
||
```bash | ||
cd http | ||
``` | ||
|
||
Build the HTTP server: | ||
|
||
```bash | ||
go build -o httpserver | ||
``` | ||
|
||
Run the HTTP server in record mode to capture the incoming HTTP calls and outgoing gRPC client calls: | ||
|
||
```bash | ||
keploy record -c "httpserver" | ||
``` | ||
|
||
### 3. Run the HTTP Server in Test Mode | ||
|
||
After recording, run the HTTP server in test mode to replay the captured calls: | ||
|
||
```bash | ||
keploy test -c "httpserver" | ||
``` | ||
|
||
--- | ||
|
||
This `README.md` provides a clear step-by-step guide for setting up and using your gRPC and HTTP servers with Keploy. Let me know if you'd like any changes! |
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,15 @@ | ||
module github.com/Sarthak160/grpc-http-sample | ||
|
||
go 1.22.1 | ||
|
||
require ( | ||
google.golang.org/grpc v1.67.1 | ||
google.golang.org/protobuf v1.35.1 | ||
) | ||
|
||
require ( | ||
golang.org/x/net v0.28.0 // indirect | ||
golang.org/x/sys v0.24.0 // indirect | ||
golang.org/x/text v0.17.0 // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect | ||
) |
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,14 @@ | ||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= | ||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= | ||
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= | ||
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= | ||
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= | ||
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= | ||
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= | ||
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= | ||
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= | ||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= | ||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= |
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,17 @@ | ||
syntax = "proto3"; | ||
|
||
package example; | ||
|
||
option go_package = "grpc-server/example;example"; // <- This line is important | ||
|
||
service ExampleService { | ||
rpc SayHello (HelloRequest) returns (HelloResponse); | ||
} | ||
|
||
message HelloRequest { | ||
string name = 1; | ||
} | ||
|
||
message HelloResponse { | ||
string message = 1; | ||
} |
182 changes: 182 additions & 0 deletions
182
grpc-http-sample/grpc/grpc-server/example/example.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.