forked from GlareDB/glaredb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare-testdata.sh
executable file
·30 lines (24 loc) · 1 KB
/
prepare-testdata.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
GCP_BUCKET_NAME="glaredb-testdata"
# Specify the testdata as "<directory to store in repo>:<object name>"
#
# Keep appending the files and write their index (as a comment) to make
# it easier for everyone to specify an index in arguments to pull specific
# files when working.
OBJECTS_TO_PULL=(
"testdata/sqllogictests_datasources_common/data:bikeshare_trips.csv" # 0
)
# Can provide the "index" of object to pull.
if [ -n $1 ]; then
OBJECTS_TO_PULL=("${OBJECTS_TO_PULL[$1]}")
fi
for OBJ in "${OBJECTS_TO_PULL[@]}"; do
OBJECT_NAME=$(echo $OBJ | cut -d ':' -f2)
# Files will be downloaded into a directory called gcs-artifacts making it
# somewhat easier to gitignore.
LOCAL_PATH=$(echo $OBJ | cut -d ':' -f1)/gcs-artifacts/
# Create the directory if it doesn't exist
test -d "$LOCAL_PATH" || mkdir -p "$LOCAL_PATH"
echo "Attempting to pull $GCP_BUCKET_NAME/$OBJECT_NAME into $LOCAL_PATH"
curl -o "$LOCAL_PATH/$OBJECT_NAME" "https://storage.googleapis.com/$GCP_BUCKET_NAME/$OBJECT_NAME"
done