Skip to content

Commit

Permalink
fix(grpc-gateway) use grpcbin in tests (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion authored and gszr committed Jun 17, 2021
1 parent 05a47c6 commit b782447
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ install:
- source ../kong-ci/setup_plugin_env.sh

script:
# uploaded file is at https://github.com/Kong/kong-plugin-grpc-gateway/pull/2
- wget https://github.com/Kong/kong-plugin-${PLUGIN_NAME}/files/4666673/server.gz -O - | gzip -d > /tmp/server
- chmod +x /tmp/server && /tmp/server &
# grpcbin docker container is started by kong-ci/setup_plugin_env.sh
- cp ../kong-plugin-${PLUGIN_NAME}/spec/fixtures/grpc/* ../kong-ci/kong/spec/fixtures/grpc
- eval $LUACHECK_CMD
- eval $BUSTED_CMD
Expand Down
6 changes: 3 additions & 3 deletions spec/01-proxy_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ for _, strategy in helpers.each_strategy() do
name = "grpc",
protocol = "grpc",
host = "localhost",
port = 50051,
port = 15002,
})

local route1 = assert(bp.routes:insert {
Expand Down Expand Up @@ -63,7 +63,7 @@ for _, strategy in helpers.each_strategy() do
local body = res:read_body()
local data = cjson.decode(body)

assert.same({message = "Hello john_doe"}, data)
assert.same({reply = "hello john_doe"}, data)
end)

test("additional binding", function()
Expand All @@ -74,7 +74,7 @@ for _, strategy in helpers.each_strategy() do

local data = cjson.decode((res:read_body()))

assert.same({message = "Hello john_doe"}, data)
assert.same({reply = "hello john_doe"}, data)
end)

test("unknown path", function()
Expand Down
30 changes: 11 additions & 19 deletions spec/fixtures/grpc/helloworld.proto
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
syntax = "proto3";

option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
package hello;

package helloworld;

// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {
service HelloService {
rpc SayHello(HelloRequest) returns (HelloResponse) {
option (google.api.http) = {
// https://github.com/googleapis/googleapis/blob/master/google/api/http.proto
// HTTP | gRPC
// -----|-----
// `GET /v1/messages/123456` | `HelloRequest(name: "123456")`
get: "/v1/messages/{name}"
// `GET /v1/messages/123456` | `HelloRequest(greeting: "123456")`
get: "/v1/messages/{greeting}"
additional_bindings {
get: "/v1/messages/legacy/{name=**}"
get: "/v1/messages/legacy/{greeting=**}"
}
post: "/v1/messages/"
body: "*"
};
}
}
};
}

// The request message containing the user's name.
message HelloRequest {
string name = 1;
required string greeting = 1;
}

// The response message containing the greetings
message HelloReply {
string message = 1;
message HelloResponse {
required string reply = 1;
}

0 comments on commit b782447

Please sign in to comment.