Skip to content

Commit 68941ff

Browse files
authored
ci: silence storage testbench set up (#8262)
We use `curl` to create a couple of buckets in the storage testbench. With this change the curl invocations are silent on success.
1 parent 45d4838 commit 68941ff

3 files changed

Lines changed: 19 additions & 14 deletions

File tree

ci/lib/run_gcs_httpbin_emulator_utils.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,18 @@ start_emulator() {
113113
fi
114114
export CLOUD_STORAGE_GRPC_ENDPOINT="localhost:${grpc_port}"
115115
}
116+
117+
# Create the testbench resources used in integration tests
118+
#
119+
# The google/cloud/storage integration tests assume that some resources already
120+
# exist in the testbench (or production). This function creates the resources.
121+
create_testbench_resources() {
122+
printf '{"name": "%s"}' "${GOOGLE_CLOUD_CPP_STORAGE_TEST_BUCKET_NAME}" |
123+
curl -s -o /dev/null -X POST --data-binary @- \
124+
-H "Content-Type: application/json" \
125+
"${CLOUD_STORAGE_EMULATOR_ENDPOINT}/storage/v1/b?project=${GOOGLE_CLOUD_PROJECT}"
126+
printf '{"name": "%s"}' "${GOOGLE_CLOUD_CPP_STORAGE_TEST_DESTINATION_BUCKET_NAME}" |
127+
curl -s -o /dev/null -X POST --data-binary @- \
128+
-H "Content-Type: application/json" \
129+
"${CLOUD_STORAGE_EMULATOR_ENDPOINT}/storage/v1/b?project=${GOOGLE_CLOUD_PROJECT}"
130+
}

google/cloud/storage/ci/run_integration_tests_emulator_bazel.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,8 @@ for target in "${production_only_targets[@]}"; do
7777
excluded_targets+=("-${target}")
7878
done
7979

80-
# Create the test buckets in the emulator:
81-
printf '{"name": "%s"}' "${GOOGLE_CLOUD_CPP_STORAGE_TEST_BUCKET_NAME}" |
82-
curl -X POST -H "Content-Type: application/json" --data-binary @- \
83-
"${CLOUD_STORAGE_EMULATOR_ENDPOINT}/storage/v1/b?project=${GOOGLE_CLOUD_PROJECT}"
84-
printf '{"name": "%s"}' "${GOOGLE_CLOUD_CPP_STORAGE_TEST_DESTINATION_BUCKET_NAME}" |
85-
curl -X POST -H "Content-Type: application/json" --data-binary @- \
86-
"${CLOUD_STORAGE_EMULATOR_ENDPOINT}/storage/v1/b?project=${GOOGLE_CLOUD_PROJECT}"
80+
# Create any GCS resources needed to run the tests
81+
create_testbench_resources
8782

8883
# This is just the SHA for the *description* of the testbench, it includes its
8984
# version and other info, but no details about the contents.

google/cloud/storage/ci/run_integration_tests_emulator_cmake.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,8 @@ ctest_args=("$@")
3636
cd "${BINARY_DIR}"
3737
start_emulator
3838

39-
# Create the test buckets in the emulator:
40-
printf '{"name": "%s"}' "${GOOGLE_CLOUD_CPP_STORAGE_TEST_BUCKET_NAME}" |
41-
curl -X POST -H "Content-Type: application/json" --data-binary @- \
42-
"${CLOUD_STORAGE_EMULATOR_ENDPOINT}/storage/v1/b?project=${GOOGLE_CLOUD_PROJECT}"
43-
printf '{"name": "%s"}' "${GOOGLE_CLOUD_CPP_STORAGE_TEST_DESTINATION_BUCKET_NAME}" |
44-
curl -s -X POST -H "Content-Type: application/json" --data-binary @- \
45-
"${CLOUD_STORAGE_EMULATOR_ENDPOINT}/storage/v1/b?project=${GOOGLE_CLOUD_PROJECT}"
39+
# Create any GCS resources needed to run the tests
40+
create_testbench_resources
4641

4742
ctest -R "^storage_" "${ctest_args[@]}"
4843
exit_status=$?

0 commit comments

Comments
 (0)