Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 6 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -447,19 +447,19 @@ def buildPackages() {
'//src/tools:auth_token_gen',
'//test/grpc:grpc-test-client',
'//test/grpc:interop-client',
'//test/grpc:interop-metrics-client',
'//test/grpc:interop-server',
'//test/grpc:interop-stress-client',
'@org_golang_google_grpc//stress/metrics_client',
'@org_golang_google_grpc//interop/server',
'@org_golang_google_grpc//stress/client',
'//test/grpc:grpc-test_descriptor',
'//test/grpc:grpc-interop_descriptor',
]
def stashPaths = [
'bazel-bin/src/tools/auth_token_gen',
'bazel-bin/test/grpc/grpc-test-client',
'bazel-bin/test/grpc/interop-client',
'bazel-bin/test/grpc/interop-metrics-client',
'bazel-bin/test/grpc/interop-server',
'bazel-bin/test/grpc/interop-stress-client',
'bazel-bin/external/org_golang_google_grpc/stress/metrics_client/metrics_client',
'bazel-bin/external/org_golang_google_grpc/interop/server/server',
'bazel-bin/external/org_golang_google_grpc/stress/client/client',
'bazel-genfiles/test/grpc/grpc-test.descriptor',
'bazel-genfiles/test/grpc/grpc-interop.descriptor',
]
Expand Down Expand Up @@ -887,4 +887,3 @@ def initialize() {
// Updating submodules and cleaning files.
sh('script/setup && script/obliterate')
}

21 changes: 6 additions & 15 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,6 @@ googletest_repositories()

grpc_repositories()

# Though GRPC has BUILD file, our own BUILD.grpc file is needed since it contains
# more targets including testing server and client.
# To generate the BUILD.grpc file, cherry-pick
# https://github.com/grpc/grpc/pull/7556
# and run ./tools/buildgen/generate_projects.sh in GRPC repo.
new_git_repository(
name = "grpc_test_git",
build_file = "third_party/BUILD.grpc",
commit = "d28417c856366df704200f544e72d31056931bce",
init_submodules = True,
remote = "https://github.com/grpc/grpc.git",
)

# Workaround for Bazel > 0.4.0 since it needs newer protobuf.bzl from:
# https://github.com/google/protobuf/pull/2246
# Do not use this git_repository for anything else than protobuf.bzl
Expand Down Expand Up @@ -171,11 +158,11 @@ git_repository(
#
git_repository(
name = "io_bazel_rules_go",
commit = "3b13b2dba81e09ec213ccbd4da56ad332cb5d3dc",
commit = "76c63b5cd0d47c1f2b47ab4953db96c574af1c1d",
remote = "https://github.com/bazelbuild/rules_go.git",
)

load("@io_bazel_rules_go//go:def.bzl", "go_repositories", "go_repository")
load("@io_bazel_rules_go//go:def.bzl", "go_repositories", "go_repository", "new_go_repository")

go_repositories()

Expand All @@ -185,3 +172,7 @@ new_git_repository(
commit = "8616e8ee5e20a1704615e6c8d7afcdac06087a67",
remote = "https://github.com/golang/protobuf.git",
)

load("//test/grpc:repositories.bzl", "grpc_go_repositories")

grpc_go_repositories()
4 changes: 2 additions & 2 deletions script/test-grpc-interop
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function print_test_metrics() {
sleep 10
local curr_time=$(date +"%s")
echo -n "QPS report at $((curr_time - start_time)) seconds:"
$ROOT/bazel-bin/test/grpc/interop-metrics-client --total_only
$ROOT/bazel-bin/external/org_golang_google_grpc/stress/metrics_client/metrics_client --total_only
done
}

Expand Down Expand Up @@ -91,7 +91,7 @@ while true; do
echo "Test time: $((CURR_TIME - START_TIME)) seconds, success time: ${SUCCESS_TIME} seconds."
((RUN_COUNT++))

timeout $((RUN_LENGTH + 10)) $ROOT/bazel-bin/test/grpc/interop-stress-client \
timeout $((RUN_LENGTH + 10)) $ROOT/bazel-bin/external/org_golang_google_grpc/stress/client/client \
--server_addresses "${HOST}" \
--test_duration_secs "${RUN_LENGTH}" \
--num_channels_per_server 200 \
Expand Down
2 changes: 1 addition & 1 deletion src/nginx/t/ApiManager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ sub grpc_test_server {

sub grpc_interop_server {
my ($t, $port) = @_;
my $server = './test/grpc/interop-server';
my $server = './external/org_golang_google_grpc/interop/server/server';
exec $server, "--port", $port;
}

Expand Down
2 changes: 1 addition & 1 deletion src/nginx/t/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ nginx_suite(
size = "small",
data = [
"//test/grpc:interop-client",
"//test/grpc:interop-server",
"@org_golang_google_grpc//interop/server",
],
nginx = "//src/nginx/main:nginx-esp",
tests = [
Expand Down
7 changes: 4 additions & 3 deletions src/nginx/t/grpc_interop_cancel.t
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ my $ServiceControlPort = ApiManager::pick_port();
my $GrpcBackendPort = ApiManager::pick_port();
my $HttpBackendPort = ApiManager::pick_port();

my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(5);
my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(4);

$t->write_file(
'service.pb.txt',
Expand Down Expand Up @@ -85,13 +85,14 @@ is($t->waitforsocket("127.0.0.1:${Http2NginxPort}"), 1, 'Nginx socket ready.');

################################################################################
my @test_cases = (
'cancel_after_begin',
# Temporary disabled per b/35314304
# 'cancel_after_begin',
'cancel_after_first_response',
);

foreach my $case (@test_cases) {
my $result = &ApiManager::run_grpc_interop_test($t, $Http2NginxPort,
$case, '--global_metadata', 'x-api-key:api-key');
$case, '--api_key', 'api-key');
is($result, 0, "${case} test completed as expected.");
}

Expand Down
2 changes: 1 addition & 1 deletion src/nginx/t/grpc_interop_metadata.t
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ my @test_cases = (

foreach my $case (@test_cases) {
my $result = &ApiManager::run_grpc_interop_test($t, $Http2NginxPort,
$case, '--global_metadata', 'x-api-key:api-key');
$case, '--api_key', 'api-key');
is($result, 0, "${case} test completed as expected.");
}

Expand Down
2 changes: 1 addition & 1 deletion src/nginx/t/grpc_interop_status.t
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ my @test_cases = (

foreach my $case (@test_cases) {
my $result = &ApiManager::run_grpc_interop_test($t, $Http2NginxPort,
$case, '--global_metadata', 'x-api-key:api-key');
$case, '--api_key', 'api-key');
is($result, 0, "${case} test completed as expected.");
}

Expand Down
4 changes: 2 additions & 2 deletions src/nginx/t/grpc_interop_streaming.t
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ is($t->waitforsocket("127.0.0.1:${Http2NginxPort}"), 1, 'Nginx socket ready.');
my @test_cases = (
'client_streaming',
'empty_stream',
'half_duplex',
'ping_pong',
'server_streaming',
'timeout_on_sleeping_server',
);

foreach my $case (@test_cases) {
my $result = &ApiManager::run_grpc_interop_test($t, $Http2NginxPort,
$case, '--global_metadata', 'x-api-key:api-key');
$case, '--api_key', 'api-key');
is($result, 0, "${case} test completed as expected.");
}

Expand Down
2 changes: 1 addition & 1 deletion src/nginx/t/grpc_interop_unary.t
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ my @test_cases = (

foreach my $case (@test_cases) {
my $result = &ApiManager::run_grpc_interop_test($t, $Http2NginxPort,
$case, '--global_metadata', 'x-api-key:api-key');
$case, '--api_key', 'api-key');
is($result, 0, "${case} test completed as expected.");
}

Expand Down
50 changes: 19 additions & 31 deletions test/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,13 @@ genrule(
name = "grpc-interop_descriptor",
srcs = [
"@protobuf_git//:well_known_protos",
"@grpc_test_git//:src/proto/grpc/testing/test.proto",
"@grpc_test_git//:src/proto/grpc/testing/empty.proto",
"@grpc_test_git//:src/proto/grpc/testing/messages.proto",
"@org_golang_google_grpc//interop/grpc_testing:go_default_library_protos",
],
outs = ["grpc-interop.descriptor"],
cmd = """$(location //external:protoc) \
$(location @grpc_test_git//:src/proto/grpc/testing/test.proto) \
$(location @org_golang_google_grpc//interop/grpc_testing:go_default_library_protos) \
-I$$(dirname $(location @org_golang_google_grpc//interop/grpc_testing:go_default_library_protos)) \
-Iexternal/protobuf_git/src \
-I$$(dirname $(location @grpc_test_git//:src/proto/grpc/testing/test.proto))/../../../.. \
-I$$(dirname $(location @grpc_test_git//:src/proto/grpc/testing/test.proto)) \
--include_imports --descriptor_set_out=$@""",
tools = ["//external:protoc"],
)
Expand Down Expand Up @@ -127,40 +124,31 @@ cc_binary(
deps = [":grpc-test_proto"],
)

cc_binary(
name = "interop-server",
testonly = 1,
deps = [
"@grpc_test_git//:interop_server_main",
],
)

cc_binary(
name = "interop-stress-client",
testonly = 1,
deps = [
"@grpc_test_git//:stress_test",
],
load(
"@io_bazel_rules_go//go:def.bzl",
"go_prefix",
"go_binary",
)

cc_binary(
name = "interop-metrics-client",
testonly = 1,
deps = [
"@grpc_test_git//:metrics_client",
],
)
go_prefix("github.com/cloudendpoints/esp/test/grpc")

cc_binary(
go_binary(
name = "interop-client",
testonly = 1,
srcs = [
"interop-client.cc",
"interop-client.go",
],
deps = [
"@grpc_test_git//:interop_client_main",
"@org_golang_x_net//context:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//credentials:go_default_library",
"@org_golang_google_grpc//credentials/oauth:go_default_library",
"@org_golang_google_grpc//grpclog:go_default_library",
"@org_golang_google_grpc//interop:go_default_library",
"@org_golang_google_grpc//interop/grpc_testing:go_default_library",
],
go_prefix = ":go_prefix",
)


# Export service.json such that the tests can use it
exports_files(["local/service.json"])
Loading