Skip to content

Commit 1042627

Browse files
authored
ci: run test install programs in CI builds (#3245)
The CI builds to verify our install instructions work compile a couple of test programs against the installed code. The programs were not executed though. This PR proposes to run the tests as part of these CI builds, note that these run against the production environment.
1 parent 3b0f533 commit 1042627

13 files changed

+72
-48
lines changed

ci/etc/kokoro/install/run-installed-programs.sh

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,34 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
run_args=(
17-
# Remove the container after running
18-
"--rm"
19-
)
16+
CONFIG_DIRECTORY="${KOKORO_GFILE_DIR:-/dev/shm}"
17+
readonly CONFIG_DIRECTORY
18+
if [[ -f "${CONFIG_DIRECTORY}/test-configuration.sh" ]]; then
19+
source "${CONFIG_DIRECTORY}/test-configuration.sh"
2020

21-
echo "================================================================"
22-
echo "Run Bigtable test programs against installed libraries ${DISTRO}."
23-
docker run "${run_args[@]}" "${INSTALL_RUN_IMAGE}" "/i/bigtable/bigtable_install_test"
21+
run_args=(
22+
# Remove the container after running
23+
"--rm"
2424

25-
echo "Run Storage test programs against installed libraries ${DISTRO}."
26-
docker run "${run_args[@]}" "${INSTALL_RUN_IMAGE}" "/i/storage/storage_install_test"
27-
echo "================================================================"
25+
# Set the environment variables for the test program.
26+
"--env" "GOOGLE_APPLICATION_CREDENTIALS=/c/service-account.json"
27+
"--env" "GOOGLE_CLOUD_PROJECT=${PROJECT_ID}"
28+
29+
# Mount the config directory as a volume in `/c`
30+
"--volume" "${CONFIG_DIRECTORY}:/c"
31+
)
32+
readonly NONCE="$(date +%s)-${RANDOM}"
33+
34+
echo "================================================================"
35+
echo "Run Bigtable test programs against installed libraries ${DISTRO}."
36+
docker run "${run_args[@]}" "${INSTALL_RUN_IMAGE}" \
37+
"/i/bigtable/bigtable_install_test" \
38+
"${PROJECT_ID}" "${INSTANCE_ID}" "tbl-${NONCE}"
39+
40+
41+
echo "Run Storage test programs against installed libraries ${DISTRO}."
42+
docker run "${run_args[@]}" "${INSTALL_RUN_IMAGE}" \
43+
"/i/storage/storage_install_test" \
44+
"${BUCKET_NAME}" "object-${NONCE}.txt"
45+
echo "================================================================"
46+
fi

ci/kokoro/install/Dockerfile.centos-7

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ RUN make
199199

200200
WORKDIR /home/build/test-install-cmake-bigtable
201201
COPY ci/test-install/bigtable /home/build/test-install-cmake-bigtable
202-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
203-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
202+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/bigtable
203+
RUN cmake --build /i/bigtable -- -j ${NCPU:-4}
204204

205205
WORKDIR /home/build/test-install-cmake-storage
206206
COPY ci/test-install/storage /home/build/test-install-cmake-storage
207-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
208-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
207+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/storage
208+
RUN cmake --build /i/storage -- -j ${NCPU:-4}
209209

210210
WORKDIR /home/build/test-submodule
211211
COPY ci/test-install /home/build/test-submodule

ci/kokoro/install/Dockerfile.debian-buster

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ RUN make
162162

163163
WORKDIR /home/build/test-install-cmake-bigtable
164164
COPY ci/test-install/bigtable /home/build/test-install-cmake-bigtable
165-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
166-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
165+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/bigtable
166+
RUN cmake --build /i/bigtable -- -j ${NCPU:-4}
167167

168168
WORKDIR /home/build/test-install-cmake-storage
169169
COPY ci/test-install/storage /home/build/test-install-cmake-storage
170-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
171-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
170+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/storage
171+
RUN cmake --build /i/storage -- -j ${NCPU:-4}
172172

173173
WORKDIR /home/build/test-submodule
174174
COPY ci/test-install /home/build/test-submodule

ci/kokoro/install/Dockerfile.debian-stretch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ RUN make
172172

173173
WORKDIR /home/build/test-install-cmake-bigtable
174174
COPY ci/test-install/bigtable /home/build/test-install-cmake-bigtable
175-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
176-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
175+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/bigtable
176+
RUN cmake --build /i/bigtable -- -j ${NCPU:-4}
177177

178178
WORKDIR /home/build/test-install-cmake-storage
179179
COPY ci/test-install/storage /home/build/test-install-cmake-storage
180-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
181-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
180+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/storage
181+
RUN cmake --build /i/storage -- -j ${NCPU:-4}
182182

183183
WORKDIR /home/build/test-submodule
184184
COPY ci/test-install /home/build/test-submodule

ci/kokoro/install/Dockerfile.fedora

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ RUN make
140140

141141
WORKDIR /home/build/test-install-cmake-bigtable
142142
COPY ci/test-install/bigtable /home/build/test-install-cmake-bigtable
143-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
144-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
143+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/bigtable
144+
RUN cmake --build /i/bigtable -- -j ${NCPU:-4}
145145

146146
WORKDIR /home/build/test-install-cmake-storage
147147
COPY ci/test-install/storage /home/build/test-install-cmake-storage
148-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
149-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
148+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/storage
149+
RUN cmake --build /i/storage -- -j ${NCPU:-4}
150150

151151
WORKDIR /home/build/test-submodule
152152
COPY ci/test-install /home/build/test-submodule

ci/kokoro/install/Dockerfile.opensuse-leap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,13 @@ RUN make
213213

214214
WORKDIR /home/build/test-install-cmake-bigtable
215215
COPY ci/test-install/bigtable /home/build/test-install-cmake-bigtable
216-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
217-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
216+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/bigtable
217+
RUN cmake --build /i/bigtable -- -j ${NCPU:-4}
218218

219219
WORKDIR /home/build/test-install-cmake-storage
220220
COPY ci/test-install/storage /home/build/test-install-cmake-storage
221-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
222-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
221+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/storage
222+
RUN cmake --build /i/storage -- -j ${NCPU:-4}
223223

224224
WORKDIR /home/build/test-submodule
225225
COPY ci/test-install /home/build/test-submodule

ci/kokoro/install/Dockerfile.opensuse-tumbleweed

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ RUN make
135135

136136
WORKDIR /home/build/test-install-cmake-bigtable
137137
COPY ci/test-install/bigtable /home/build/test-install-cmake-bigtable
138-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
139-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
138+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/bigtable
139+
RUN cmake --build /i/bigtable -- -j ${NCPU:-4}
140140

141141
WORKDIR /home/build/test-install-cmake-storage
142142
COPY ci/test-install/storage /home/build/test-install-cmake-storage
143-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
144-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
143+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/storage
144+
RUN cmake --build /i/storage -- -j ${NCPU:-4}
145145

146146
WORKDIR /home/build/test-submodule
147147
COPY ci/test-install /home/build/test-submodule

ci/kokoro/install/Dockerfile.ubuntu-bionic

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,13 @@ RUN make
165165

166166
WORKDIR /home/build/test-install-cmake-bigtable
167167
COPY ci/test-install/bigtable /home/build/test-install-cmake-bigtable
168-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
169-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
168+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/bigtable
169+
RUN cmake --build /i/bigtable -- -j ${NCPU:-4}
170170

171171
WORKDIR /home/build/test-install-cmake-storage
172172
COPY ci/test-install/storage /home/build/test-install-cmake-storage
173-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
174-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
173+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/storage
174+
RUN cmake --build /i/storage -- -j ${NCPU:-4}
175175

176176
WORKDIR /home/build/test-submodule
177177
COPY ci/test-install /home/build/test-submodule

ci/kokoro/install/Dockerfile.ubuntu-trusty

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,13 @@ RUN make
235235

236236
WORKDIR /home/build/test-install-cmake-bigtable
237237
COPY ci/test-install/bigtable /home/build/test-install-cmake-bigtable
238-
RUN cmake -H. -Bcmake-out -DCMAKE_FIND_ROOT_PATH="/usr/local/curl;/usr/local/ssl"
239-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
238+
RUN cmake -H. -B/i/bigtable -DCMAKE_FIND_ROOT_PATH="/usr/local/curl;/usr/local/ssl"
239+
RUN cmake --build /i/bigtable -- -j ${NCPU:-4}
240240

241241
WORKDIR /home/build/test-install-cmake-storage
242242
COPY ci/test-install/storage /home/build/test-install-cmake-storage
243-
RUN cmake -H. -Bcmake-out -DCMAKE_FIND_ROOT_PATH="/usr/local/curl;/usr/local/ssl"
244-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
243+
RUN cmake -H. -B/i/storage -DCMAKE_FIND_ROOT_PATH="/usr/local/curl;/usr/local/ssl"
244+
RUN cmake --build /i/storage -- -j ${NCPU:-4}
245245

246246
WORKDIR /home/build/test-submodule
247247
COPY ci/test-install /home/build/test-submodule

ci/kokoro/install/Dockerfile.ubuntu-xenial

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ RUN make
188188

189189
WORKDIR /home/build/test-install-cmake-bigtable
190190
COPY ci/test-install/bigtable /home/build/test-install-cmake-bigtable
191-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
192-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
191+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/bigtable
192+
RUN cmake --build /i/bigtable -- -j ${NCPU:-4}
193193

194194
WORKDIR /home/build/test-install-cmake-storage
195195
COPY ci/test-install/storage /home/build/test-install-cmake-storage
196-
RUN env -u PKG_CONFIG_PATH cmake -H. -Bcmake-out
197-
RUN cmake --build cmake-out -- -j ${NCPU:-4}
196+
RUN env -u PKG_CONFIG_PATH cmake -H. -B/i/storage
197+
RUN cmake --build /i/storage -- -j ${NCPU:-4}
198198

199199
WORKDIR /home/build/test-submodule
200200
COPY ci/test-install /home/build/test-submodule

0 commit comments

Comments
 (0)