Merge branch 'httpsclibazel'

pull/14239/head
Adele Zhou 7 years ago
commit 1620b327d3
  1. 1
      test/core/http/BUILD
  2. 2
      test/core/http/httpcli_test.cc
  3. 10
      test/core/http/httpscli_test.cc

@ -88,6 +88,7 @@ grpc_cc_test(
data = [ data = [
"python_wrapper.sh", "python_wrapper.sh",
"test_server.py", "test_server.py",
"//src/core/tsi/test_creds:ca.pem",
"//src/core/tsi/test_creds:server1.pem", "//src/core/tsi/test_creds:server1.pem",
"//src/core/tsi/test_creds:server1.key" "//src/core/tsi/test_creds:server1.key"
], ],

@ -156,7 +156,7 @@ int main(int argc, char** argv) {
char* root; char* root;
if (lslash != nullptr) { if (lslash != nullptr) {
/* Hack for bazel target */ /* Hack for bazel target */
if (lslash - me >= (unsigned)(sizeof("http") - 1) && if ((unsigned)(lslash - me) >= (sizeof("http") - 1) &&
strncmp(me + (lslash - me) - sizeof("http") + 1, "http", strncmp(me + (lslash - me) - sizeof("http") + 1, "http",
sizeof("http") - 1) == 0) { sizeof("http") - 1) == 0) {
lslash = me + (lslash - me) - sizeof("http"); lslash = me + (lslash - me) - sizeof("http");

@ -21,11 +21,13 @@
#include <string.h> #include <string.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/grpc_security_constants.h>
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/string_util.h> #include <grpc/support/string_util.h>
#include <grpc/support/subprocess.h> #include <grpc/support/subprocess.h>
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/iomgr.h"
#include "test/core/util/port.h" #include "test/core/util/port.h"
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
@ -154,7 +156,7 @@ int main(int argc, char** argv) {
char* root; char* root;
if (lslash != nullptr) { if (lslash != nullptr) {
/* Hack for bazel target */ /* Hack for bazel target */
if (lslash - me >= (unsigned)(sizeof("http") - 1) && if ((unsigned)(lslash - me) >= (sizeof("http") - 1) &&
strncmp(me + (lslash - me) - sizeof("http") + 1, "http", strncmp(me + (lslash - me) - sizeof("http") + 1, "http",
sizeof("http") - 1) == 0) { sizeof("http") - 1) == 0) {
lslash = me + (lslash - me) - sizeof("http"); lslash = me + (lslash - me) - sizeof("http");
@ -176,6 +178,12 @@ int main(int argc, char** argv) {
gpr_asprintf(&args[1], "%s/test/core/http/test_server.py", root); gpr_asprintf(&args[1], "%s/test/core/http/test_server.py", root);
} }
/* Set the environment variable for the SSL certificate file */
char* pem_file;
gpr_asprintf(&pem_file, "%s/src/core/tsi/test_creds/ca.pem", root);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, pem_file);
gpr_free(pem_file);
/* start the server */ /* start the server */
args[1 + arg_shift] = const_cast<char*>("--port"); args[1 + arg_shift] = const_cast<char*>("--port");
gpr_asprintf(&args[2 + arg_shift], "%d", port); gpr_asprintf(&args[2 + arg_shift], "%d", port);

Loading…
Cancel
Save