Skip to content

Commit bd7a3cb

Browse files
author
anindyatahsin
authored
Merge pull request #518 from GoogleCloudPlatform/docker-testing
Docker testing
2 parents dabd6d1 + 321151f commit bd7a3cb

File tree

9 files changed

+184
-1
lines changed

9 files changed

+184
-1
lines changed

alpine/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ RUN ARCH=`cat /tmp/arch` && apk --no-cache upgrade && apk --no-cache add \
2525
gcloud config set core/disable_usage_reporting true && \
2626
gcloud config set component_manager/disable_update_check true && \
2727
gcloud config set metrics/environment docker_image_alpine && \
28-
gcloud --version
28+
gcloud --version && \
29+
gsutil version -l && \
30+
bq version && \
31+
gcloud-crc32c /google-cloud-sdk/bin/gcloud
2932
RUN git config --system credential.'https://source.developers.google.com'.helper gcloud.sh
3033
VOLUME ["/root/.config"]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
apt-get update && apt-get install -y lsof
4+
5+
# Start the server in the background
6+
gcloud beta emulators $1 start --host-port=0.0.0.0:8085 --project=blah &
7+
8+
# Wait a few seconds for the server to start
9+
sleep 10
10+
11+
# Check if the server is listening on the port
12+
if lsof -i :8085 > /dev/null; then
13+
echo "Server started successfully (exiting with code 0)"
14+
kill -9 $(lsof -t -i :8085)
15+
exit 0
16+
else
17+
echo "Server failed to start"
18+
exit 1
19+
fi
20+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
echo "Checking gsutil version"
4+
gsutil version
5+
6+
echo "Checking kpt version"
7+
kpt version
8+
9+
echo "Checking local-extract version"
10+
local-extract --version
11+
12+
echo "Checking gke-gcloud-auth-plugin version"
13+
gke-gcloud-auth-plugin --version
14+
15+
echo "Checking bq version"
16+
bq version
17+
18+
echo "Checking bundled-python version"
19+
/usr/lib/google-cloud-sdk/platform/bundledpythonunix/bin/python --version
20+
21+
echo "Checking cbt version"
22+
cbt version
23+
24+
echo "Checking crc checksum for gcloud"
25+
gcloud-crc32c /usr/bin/gcloud
26+
27+
echo "Checking kubectl version"
28+
kubectl version
29+
30+
echo "Checking the emulators"
31+
./test-all-emulators.sh
32+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
#!/bin/bash
3+
4+
./emulator-testing.sh pubsub
5+
if [ $? -ne 0 ]; then
6+
7+
echo "Pub/sub emulator failed to execute."
8+
exit 1
9+
10+
fi
11+
12+
./emulator-testing.sh datastore
13+
if [ $? -ne 0 ]; then
14+
15+
echo "Datastore emulator failed to execute."
16+
exit 1
17+
18+
fi
19+
20+
./emulator-testing.sh bigtable
21+
if [ $? -ne 0 ]; then
22+
23+
echo "Bigtable emulator failed to execute."
24+
exit 1
25+
26+
fi
27+

debian_slim/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ RUN apt-get update -qqy && apt-get -qqy upgrade && apt-get install -qqy \
2828
gcloud config set component_manager/disable_update_check true && \
2929
gcloud config set metrics/environment docker_image_slim && \
3030
gcloud --version && \
31+
gsutil version -l && \
32+
bq version && \
33+
gcloud-crc32c /usr/bin/gcloud && \
3134
docker --version
3235
RUN git config --system credential.'https://source.developers.google.com'.helper gcloud.sh
3336
VOLUME ["/root/.config"]

emulators/emulator-testing.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
apt-get update && apt-get install -y lsof
4+
5+
# Start the server in the background
6+
gcloud beta emulators $1 start --host-port=0.0.0.0:8085 --project=blah &
7+
8+
# Wait a few seconds for the server to start
9+
sleep 10
10+
11+
# Check if the server is listening on the port
12+
if lsof -i :8085 > /dev/null; then
13+
echo "Server started successfully (exiting with code 0)"
14+
kill -9 $(lsof -t -i :8085)
15+
exit 0
16+
else
17+
echo "Server failed to start"
18+
exit 1
19+
fi
20+

emulators/test-all-emulators.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
#!/bin/bash
3+
4+
./emulator-testing.sh pubsub
5+
if [ $? -ne 0 ]; then
6+
7+
echo "Pub/sub emulator failed to execute."
8+
exit 1
9+
10+
fi
11+
12+
./emulator-testing.sh datastore
13+
if [ $? -ne 0 ]; then
14+
15+
echo "Datastore emulator failed to execute."
16+
exit 1
17+
18+
fi
19+
20+
./emulator-testing.sh firestore
21+
if [ $? -ne 0 ]; then
22+
23+
echo "Firestore emulator failed to execute."
24+
exit 1
25+
26+
fi
27+
28+
./emulator-testing.sh spanner
29+
if [ $? -ne 0 ]; then
30+
31+
echo "Spanner emulator failed to execute."
32+
exit 1
33+
34+
fi
35+
36+
./emulator-testing.sh bigtable
37+
if [ $? -ne 0 ]; then
38+
39+
echo "Bigtable emulator failed to execute."
40+
exit 1
41+
42+
fi
43+

stable/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ RUN if [ `uname -m` = 'x86_64' ]; then echo -n "x86_64" > /tmp/arch; else echo -
3030
python3-dev \
3131
python3-crcmod; fi;
3232
RUN gcloud --version && \
33+
gsutil version -l && \
34+
bq version && \
35+
gcloud-crc32c /usr/lib/google-cloud-sdk/bin/gcloud && \
3336
gcloud config set core/disable_usage_reporting false && \
3437
gcloud config set component_manager/disable_update_check true && \
3538
gcloud config set metrics/environment docker_image_stable && \

test-latest.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
echo "Checking gsutil version"
4+
gsutil version
5+
6+
echo "Checking kpt version"
7+
kpt version
8+
9+
echo "Checking local-extract version"
10+
local-extract --version
11+
12+
echo "Checking gke-gcloud-auth-plugin version"
13+
gke-gcloud-auth-plugin --version
14+
15+
echo "Checking bq version"
16+
bq version
17+
18+
echo "Checking bundled-python version"
19+
/usr/lib/google-cloud-sdk/platform/bundledpythonunix/bin/python --version
20+
21+
echo "Checking cbt version"
22+
cbt version
23+
24+
echo "Checking crc checksum for gcloud"
25+
gcloud-crc32c /usr/bin/gcloud
26+
27+
echo "Checking kubectl version"
28+
kubectl version
29+
30+
echo "Checking the emulators"
31+
./test-all-emulators.sh
32+

0 commit comments

Comments
 (0)