aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/http
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-01-29 16:36:05 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2018-01-29 16:36:05 -0800
commitac35926a2f7c41313c3d2c778ffd0695863a7e7d (patch)
tree6ef460d37976e759db2c40a73c9d0cb9459eb8b9 /test/core/http
parente8e2426f985c09b4e81ca997c688a824000607f2 (diff)
Manually set roots pem env variable for httpscli_test
Diffstat (limited to 'test/core/http')
-rw-r--r--test/core/http/BUILD1
-rw-r--r--test/core/http/httpcli_test.cc2
-rw-r--r--test/core/http/httpscli_test.cc10
3 files changed, 11 insertions, 2 deletions
diff --git a/test/core/http/BUILD b/test/core/http/BUILD
index c2ed1cd540..03b8f4edfe 100644
--- a/test/core/http/BUILD
+++ b/test/core/http/BUILD
@@ -88,6 +88,7 @@ grpc_cc_test(
data = [
"python_wrapper.sh",
"test_server.py",
+ "//src/core/tsi/test_creds:ca.pem",
"//src/core/tsi/test_creds:server1.pem",
"//src/core/tsi/test_creds:server1.key"
],
diff --git a/test/core/http/httpcli_test.cc b/test/core/http/httpcli_test.cc
index a8853c86dc..6ad0753f7e 100644
--- a/test/core/http/httpcli_test.cc
+++ b/test/core/http/httpcli_test.cc
@@ -156,7 +156,7 @@ int main(int argc, char** argv) {
char* root;
if (lslash != nullptr) {
/* 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",
sizeof("http") - 1) == 0) {
lslash = me + (lslash - me) - sizeof("http");
diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc
index 5f497fc920..92193bb442 100644
--- a/test/core/http/httpscli_test.cc
+++ b/test/core/http/httpscli_test.cc
@@ -21,11 +21,13 @@
#include <string.h>
#include <grpc/grpc.h>
+#include <grpc/grpc_security_constants.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/subprocess.h>
#include <grpc/support/sync.h>
+#include "src/core/lib/gpr/env.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
@@ -154,7 +156,7 @@ int main(int argc, char** argv) {
char* root;
if (lslash != nullptr) {
/* 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",
sizeof("http") - 1) == 0) {
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);
}
+ /* 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 */
args[1 + arg_shift] = const_cast<char*>("--port");
gpr_asprintf(&args[2 + arg_shift], "%d", port);