File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff line change @@ -77,13 +77,8 @@ for target in "${production_only_targets[@]}"; do
7777 excluded_targets+=(" -${target} " )
7878done
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.
Original file line number Diff line number Diff line change @@ -36,13 +36,8 @@ ctest_args=("$@")
3636cd " ${BINARY_DIR} "
3737start_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
4742ctest -R " ^storage_" " ${ctest_args[@]} "
4843exit_status=$?
You can’t perform that action at this time.
0 commit comments