Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 05966da

Browse files
author
Tianyi Chen
committed
change key mode in the code
1 parent d9abd44 commit 05966da

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

test/network/ssl_test.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ class SSLTests : public PelotonTest {};
3535
// The following keys and certificates are generated using
3636
// https://www.postgresql.org/docs/9.5/static/libpq-ssl.html
3737
// and then concate root.crt right after server.crt
38-
std::string client_crt = std::string(StringUtil::Format(
39-
"%s%s", SOURCE_FOLDER, "/test/network/ssl/root.crt"));
40-
std::string client_key = std::string(StringUtil::Format(
41-
"%s%s", SOURCE_FOLDER, "/test/network/ssl/root.key"));
42-
std::string server_crt = std::string(StringUtil::Format(
43-
"%s%s", SOURCE_FOLDER, "/test/network/ssl/server.crt"));
44-
std::string server_key = std::string(StringUtil::Format(
45-
"%s%s", SOURCE_FOLDER, "/test/network/ssl/server.key"));
46-
std::string root_crt = std::string(StringUtil::Format(
47-
"%s%s", SOURCE_FOLDER, "/test/network/ssl/root.crt"));
38+
std::string client_crt = std::string(
39+
StringUtil::Format("%s%s", SOURCE_FOLDER, "/test/network/ssl/root.crt"));
40+
std::string client_key = std::string(
41+
StringUtil::Format("%s%s", SOURCE_FOLDER, "/test/network/ssl/root.key"));
42+
std::string server_crt = std::string(
43+
StringUtil::Format("%s%s", SOURCE_FOLDER, "/test/network/ssl/server.crt"));
44+
std::string server_key = std::string(
45+
StringUtil::Format("%s%s", SOURCE_FOLDER, "/test/network/ssl/server.key"));
46+
std::string root_crt = std::string(
47+
StringUtil::Format("%s%s", SOURCE_FOLDER, "/test/network/ssl/root.crt"));
4848

4949
/**
5050
* Basic SSL connection test: Tested with valid certificats and key files
5151
*/
52-
void *BasicTest(int port) {
52+
void *TestRoutine(int port) {
5353
try {
5454
// forcing the factory to generate psql protocol handler
5555
pqxx::connection C(StringUtil::Format(
@@ -118,6 +118,7 @@ void *BasicTest(int port) {
118118
* Callback method to close server after client finishes
119119
*/
120120
TEST_F(SSLTests, BasicTest) {
121+
EXPECT_EQ(0, chmod(client_key.c_str(), S_IRUSR));
121122
peloton::PelotonInit::Initialize();
122123
LOG_INFO("Server initialized");
123124
peloton::network::PelotonServer peloton_server;
@@ -137,7 +138,7 @@ TEST_F(SSLTests, BasicTest) {
137138
std::thread serverThread([&] { peloton_server.ServerLoop(); });
138139

139140
// server & client running correctly
140-
BasicTest(port);
141+
TestRoutine(port);
141142

142143
peloton_server.Close();
143144
serverThread.join();

0 commit comments

Comments
 (0)