Skip to content

Commit

Permalink
Begin IamAuthenticationIntegrationTest
Browse files Browse the repository at this point in the history
  • Loading branch information
justing-bq committed Apr 1, 2023
1 parent b42b998 commit 775b502
Show file tree
Hide file tree
Showing 4 changed files with 377 additions and 9 deletions.
9 changes: 4 additions & 5 deletions driver/iam_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ IAM_PROXY::~IAM_PROXY() {
bool IAM_PROXY::connect(const char* host, const char* user, const char* password,
const char* database, unsigned int port, const char* socket, unsigned long flags) {

const char* auth_host = host;
if (ds->auth_host) {
host = ds_get_utf8attr(ds->auth_host, &ds->auth_host8);
auth_host = ds_get_utf8attr(ds->auth_host, &ds->auth_host8);
}

const char* region;
Expand All @@ -76,12 +77,10 @@ bool IAM_PROXY::connect(const char* host, const char* user, const char* password
}
else {
// Go with default region if region is not provided.
region = "us-east-1";
region = Aws::Region::US_EAST_1;
}

port = ds->auth_port;

std::string auth_token = this->get_auth_token(host, region, port, user, ds->auth_expiration);
std::string auth_token = this->get_auth_token(auth_host, region, ds->auth_port, user, ds->auth_expiration);

bool connect_result = next_proxy->connect(host, user, auth_token.c_str(), database, port, socket, flags);
if (!connect_result) {
Expand Down
11 changes: 9 additions & 2 deletions integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,15 @@ endif()

enable_testing()

set(TEST_SOURCES connection_string_builder.cc base_failover_integration_test.cc connection_string_builder_test.cc)
set(INTEGRATION_TESTS secrets_manager_integration_test.cc network_failover_integration_test.cc failover_integration_test.cc)
set(TEST_SOURCES
connection_string_builder.cc
base_failover_integration_test.cc
connection_string_builder_test.cc)
set(INTEGRATION_TESTS
iam_authentication_integration_test.cc
secrets_manager_integration_test.cc
network_failover_integration_test.cc
failover_integration_test.cc)

if(NOT ENABLE_PERFORMANCE_TESTS)
set(TEST_SOURCES ${TEST_SOURCES} ${INTEGRATION_TESTS})
Expand Down
Loading

0 comments on commit 775b502

Please sign in to comment.