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

Adding GRPC support to go-sdk #175

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

PranshuSrivastava
Copy link
Contributor

@PranshuSrivastava PranshuSrivastava commented Mar 10, 2023

Giving an option to the user to use either grpc or http while creating tests and mocks. GrpcEnabled field, in the server config will be used to choose one of the options.
Closes #4

keploy/keploy.go Outdated
k.setKey(r)
r.Header.Set("Content-Type", "application/json")
if k.cfg.Server.GrpcEnabled {
r, err := k.grpcClient.Test(k.Ctx, &proto.TestReq{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since, there are HTTP and GRPC_EXPORT types of tcs. Therefore, it should have proto.TestReq.GrpcResp field when tcs type is GRPC_EXPORT.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

keploy/keploy.go Outdated
k.setKey(r)
r.Header.Set("Content-Type", "application/json")
if k.cfg.Server.GrpcEnabled {
_, err = k.grpcClient.DeNoise(k.Ctx, &proto.TestReq{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, also it should have proto.TestReq.GrpcResp field assigned when tcs is of type GRPC_EXPORT.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

_, err = k.grpcClient.DeNoise(k.Ctx, &proto.TestReq{
ID: id,
AppID: k.cfg.App.Name,
Resp: &proto.HttpResp{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resp field is empty for testcase of type grpc

keploy/keploy.go Outdated
ID: tc.ID,
AppID: k.cfg.App.Name,
RunID: runId,
Resp: &proto.HttpResp{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please Resp field because this field stores response for http but in grpc, it should be empty.

keploy/keploy.go Outdated Show resolved Hide resolved
keploy/keploy.go Outdated
return nil
}
} else {
url := fmt.Sprintf("%s/regression/testcase?app=%s&offset=%d&limit=%d&testCasePath=%s&mockPath=%s&reqType=%s", k.cfg.Server.URL, k.cfg.App.Name, i, 25, k.cfg.App.TestPath, k.cfg.App.MockPath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the reqType query parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for grpc client
2 participants