Skip to content

Commit

Permalink
use service account json instead of file
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelgrosso1 committed Sep 26, 2024
1 parent 61aa78b commit 2269b3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ci/cloudbuild/builds/lib/universe_domain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function ud::bazel_run() {
function ud::bazel_test() {
mapfile -t args < <(bazel::common_args)
io::log "Executing bazel test $1 with obscured arguments:"
bazel test "${args[@]}" --test_env=UD_SA_KEY_FILE="${UD_SA_KEY_FILE}" \
bazel test "${args[@]}" --test_env=UD_SERVICE_ACCOUNT="${UD_SERVICE_ACCOUNT}" \
--test_env=UD_REGION="${UD_REGION}" \
--test_env=UD_PROJECT="${UD_PROJECT}" -- "$@"
}
10 changes: 3 additions & 7 deletions google/cloud/storage/tests/universe_domain_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,11 @@ class UniverseDomainIntegrationTest
};

auto TestOptions() {
auto sa_key_file = GetEnv("UD_SA_KEY_FILE").value_or("");
auto sa_json = GetEnv("UD_SERVICE_ACCOUNT").value_or("");
auto projectId = GetEnv("UD_PROJECT").value_or("");
Options options;

auto is = std::ifstream(sa_key_file);
is.exceptions(std::ios::badbit);
auto contents = std::string(std::istreambuf_iterator<char>(is.rdbuf()), {});
options.set<UnifiedCredentialsOption>(
MakeServiceAccountCredentials(contents));
options.set<UnifiedCredentialsOption>(MakeServiceAccountCredentials(sa_json));

auto ud_options = AddUniverseDomainOption(
ExperimentalTag{}, options.set<ProjectIdOption>(projectId));
Expand All @@ -69,7 +65,7 @@ auto TestOptions() {

TEST_F(UniverseDomainIntegrationTest, BucketAndObjectCRUD) {
auto region = GetEnv("UD_REGION").value_or("");
if (GetEnv("UD_SA_KEY_FILE").value_or("").empty() ||
if (GetEnv("UD_SERVICE_ACCOUNT").value_or("").empty() ||
GetEnv("UD_PROJECT").value_or("").empty() || region.empty())
GTEST_SKIP();

Expand Down

0 comments on commit 2269b3d

Please sign in to comment.