forked from clearcontainers/tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add initial cri-containerd tests
Run a few integration test and cri-tools tests. Fixes: clearcontainers#916 Signed-off-by: Jose Carlos Venegas Munoz <[email protected]>
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2018 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -eE | ||
set -x | ||
|
||
# Runtime to be used for testing. | ||
RUNTIME=${RUNTIME:-cc-runtime} | ||
# Variable to change project to test (eg. kata or clear-contaienrs) | ||
PROJECT_ORG="${PROJECT:-clear-containers}" | ||
readonly runtime_bin=$(command -v "${RUNTIME}") | ||
|
||
#cri-containerd configuration test variables | ||
CRITEST=${GOPATH}/bin/critest | ||
readonly tmp_dir=$(mktemp -t -d test-cri-containerd.XXXX) | ||
export REPORT_DIR="${tmp_dir}" | ||
|
||
|
||
info() { | ||
echo -e "\e[1mINFO\e[0m: $*" | ||
} | ||
|
||
|
||
cleanup() { | ||
rm -rf "${tmp_dir}" | ||
} | ||
|
||
err_report() { | ||
cat "${REPORT_DIR}/cri-containerd.log" | ||
cat "${REPORT_DIR}/containerd.log" | ||
} | ||
|
||
trap err_report ERR | ||
trap cleanup EXIT | ||
|
||
info "testing using runtime: ${runtime_bin}" | ||
|
||
# make sure cri-containerd test install the proper installation for testing | ||
rm -f "${CRITEST}" | ||
|
||
info "Configure runtime to use network bridged mode" | ||
# FIXME: cri-containerd fails using macvtap. | ||
sudo sed -r -i -e 's/^(internetworking_model=).*/\1"bridged"/g' \ | ||
/usr/share/defaults/${PROJECT_ORG}/configuration.toml | ||
|
||
|
||
cri_containerd_repo="github.com/containerd/cri-containerd" | ||
|
||
pushd "${GOPATH}/src/${cri_containerd_repo}" | ||
|
||
info "Starting test for cri-tools" | ||
sudo -E PATH="${PATH}" \ | ||
FOCUS="runtime should support basic operations on container" \ | ||
REPORT_DIR="${REPORT_DIR}" \ | ||
CRI_CONTAINERD_FLAGS="$CRI_CONTAINERD_FLAGS" \ | ||
make test-cri | ||
|
||
passing_test=( | ||
TestClearContainersCreate | ||
TestContainerStats | ||
TestContainerListStatsWithIdFilter | ||
TestContainerListStatsWithSandboxIdFilterd | ||
TestContainerListStatsWithIdSandboxIdFilter | ||
TestDuplicateName | ||
TestImageLoad | ||
TestImageFSInfo | ||
TestSandboxCleanRemove | ||
) | ||
|
||
info "Starting integration tests" | ||
for t in "${passing_test[@]}" | ||
do | ||
sudo -E PATH="${PATH}" FOCUS="${t}"\ | ||
CRI_CONTAINERD_FLAGS="$CRI_CONTAINERD_FLAGS"\ | ||
make test-integration | ||
done | ||
|
||
popd | ||
|