-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
posix filesystem call test suite based on pjdfstest #104
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright The containerd Authors. | ||
|
||
# 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. | ||
|
||
FROM golang:1.13 | ||
|
||
# basic packages | ||
RUN apt-get update -y && \ | ||
apt-get --no-install-recommends install -y libbtrfs-dev libseccomp-dev fuse \ | ||
apt-transport-https gnupg2 software-properties-common | ||
|
||
# runtime dependencies | ||
RUN git clone https://github.com/opencontainers/runc \ | ||
$GOPATH/src/github.com/opencontainers/runc && \ | ||
cd $GOPATH/src/github.com/opencontainers/runc && \ | ||
git checkout d736ef14f0288d6993a1845745d6756cfc9ddd5a && \ | ||
GO111MODULE=off make BUILDTAGS='seccomp apparmor' && \ | ||
GO111MODULE=off make install && \ | ||
git clone https://github.com/containerd/containerd \ | ||
$GOPATH/src/github.com/containerd/containerd && \ | ||
cd $GOPATH/src/github.com/containerd/containerd && \ | ||
git checkout 990076b731ec9446437972b41176a6b0f3b7bcbf && \ | ||
GO111MODULE=off make && GO111MODULE=off make install |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[proxy_plugins] | ||
[proxy_plugins.stargz] | ||
type = "snapshot" | ||
address = "/run/containerd-stargz-grpc/containerd-stargz-grpc.sock" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
noprefetch = false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM alpine:3.9 AS stage-build | ||
WORKDIR /work | ||
RUN apk add git automake autoconf build-base && \ | ||
git clone https://github.com/pjd/pjdfstest.git /work/pjdfstest && \ | ||
cd /work/pjdfstest && \ | ||
git checkout a75ea1caf843a3a1e6c866b61bf954f68cee4a85 && \ | ||
autoreconf -ifs && ./configure && make pjdfstest | ||
|
||
FROM alpine:3.9 AS stage-final | ||
WORKDIR /work | ||
COPY --from=stage-build /work/pjdfstest /work/pjdfstest | ||
RUN apk add openssl perl-test-harness-utils | ||
CMD ["prove", "-rv", "/work/pjdfstest/tests"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/bash | ||
|
||
# Copyright The containerd Authors. | ||
|
||
# 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 -euo pipefail | ||
|
||
# Check Dockerfile at script/posix/Dockerfile | ||
IMAGE_PJDFSTEST="${IMAGE_PJDFSTEST:-docker.io/sequix/pjdfstest:v1-stargz}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll also upload it when we merge it. |
||
CONTEXT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
function retry { | ||
local RETRYNUM=30 | ||
local RETRYINTERVAL=1 | ||
local TIMEOUTSEC=180 | ||
local SUCCESS=false | ||
for i in $(seq ${RETRYNUM}) ; do | ||
if eval "timeout ${TIMEOUTSEC} ${@}" ; then | ||
SUCCESS=true | ||
break | ||
fi | ||
echo "Fail(${i}). Retrying..." | ||
sleep ${RETRYINTERVAL} | ||
done | ||
if [ "${SUCCESS}" == "true" ] ; then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
} | ||
|
||
specList() { | ||
uname -r | ||
cat /etc/os-release | ||
cat /proc/cpuinfo | ||
cat /proc/meminfo | ||
mount | ||
df -T | ||
} | ||
echo "Machine spec list:" | ||
specList | ||
|
||
setup() { | ||
local REPO_CONFIG_DIR=$CONTEXT/config/ | ||
local CONTAINERD_CONFIG_DIR=/etc/containerd/ | ||
local REMOTE_SNAPSHOTTER_SOCKET=/run/containerd-stargz-grpc/containerd-stargz-grpc.sock | ||
local REMOTE_SNAPSHOTTER_CONFIG_DIR=/etc/containerd-stargz-grpc/ | ||
|
||
mkdir -p /tmp/out | ||
PREFIX=/tmp/out/ make clean | ||
PREFIX=/tmp/out/ make -j2 | ||
PREFIX=/tmp/out/ make install | ||
mkdir -p "${CONTAINERD_CONFIG_DIR}" | ||
cp "${REPO_CONFIG_DIR}"config.containerd.toml "${CONTAINERD_CONFIG_DIR}" | ||
mkdir -p "${REMOTE_SNAPSHOTTER_CONFIG_DIR}" | ||
cp "${REPO_CONFIG_DIR}"config.stargz.toml "${REMOTE_SNAPSHOTTER_CONFIG_DIR}" | ||
|
||
containerd-stargz-grpc --log-level=debug \ | ||
--address="${REMOTE_SNAPSHOTTER_SOCKET}" \ | ||
--config="${REMOTE_SNAPSHOTTER_CONFIG_DIR}config.stargz.toml" \ | ||
&>/var/log/containerd-stargz-grpc.log & | ||
retry ls "${REMOTE_SNAPSHOTTER_SOCKET}" | ||
|
||
containerd --log-level debug \ | ||
--config="${CONTAINERD_CONFIG_DIR}config.containerd.toml" \ | ||
&>/var/log/containerd.log & | ||
retry ctr version | ||
} | ||
echo "Setting up stargz-snaphsotter & containerd..." | ||
setup | ||
|
||
testPosix() { | ||
local containerID="posix-test_$(basename $(mktemp))" | ||
ctr-remote image rpull "$IMAGE_PJDFSTEST" | ||
ctr-remote run --rm --snapshotter=stargz "$IMAGE_PJDFSTEST" "$containerID" >/output || \ | ||
echo -e "\e[91mPosix test failed!\e[0m" | ||
Comment on lines
+86
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should propagate the exit code to the caller scripts (test.sh) so that Github Actions can know the success/failure of this test. |
||
} | ||
echo "Testing posix calls..." | ||
testPosix |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash | ||
|
||
# Copyright The containerd Authors. | ||
|
||
# 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 -euo pipefail | ||
|
||
cleanup() { | ||
local ORG_EXIT_CODE="${1}" | ||
rm "${DOCKER_COMPOSE_YAML}" || true | ||
exit "${ORG_EXIT_CODE}" | ||
} | ||
trap 'cleanup "$?"' EXIT SIGHUP SIGINT SIGQUIT SIGTERM | ||
|
||
CONTEXT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/" | ||
REPO="${CONTEXT}../../" | ||
|
||
echo "Preparing docker-compose.yml..." | ||
DOCKER_COMPOSE_YAML=$(mktemp) | ||
BENCHMARKING_NODE=posix-test | ||
BENCHMARKING_CONTAINER=posix-test | ||
cat <<EOF > "${DOCKER_COMPOSE_YAML}" | ||
version: "3" | ||
services: | ||
${BENCHMARKING_NODE}: | ||
build: | ||
context: "${CONTEXT}/" | ||
dockerfile: Dockerfile | ||
container_name: ${BENCHMARKING_CONTAINER} | ||
privileged: true | ||
working_dir: /go/src/github.com/containerd/stargz-snapshotter | ||
command: tail -f /dev/null | ||
environment: | ||
- NO_PROXY=127.0.0.1,localhost | ||
- HTTP_PROXY=${HTTP_PROXY:-} | ||
- HTTPS_PROXY=${HTTPS_PROXY:-} | ||
- http_proxy=${http_proxy:-} | ||
- https_proxy=${https_proxy:-} | ||
tmpfs: | ||
- /tmp:exec,mode=777 | ||
volumes: | ||
- "${REPO}:/go/src/github.com/containerd/stargz-snapshotter:ro" | ||
- "/dev/fuse:/dev/fuse" | ||
- "containerd-data:/var/lib/containerd:delegated" | ||
- "containerd-stargz-grpc-data:/var/lib/containerd-stargz-grpc:delegated" | ||
- "containerd-stargz-grpc-status:/run/containerd-stargz-grpc:delegated" | ||
volumes: | ||
containerd-data: | ||
containerd-stargz-grpc-data: | ||
containerd-stargz-grpc-status: | ||
EOF | ||
|
||
echo "Setup posix test environment..." | ||
docker-compose -f "${DOCKER_COMPOSE_YAML}" build ${DOCKER_BUILD_ARGS:-} "${BENCHMARKING_NODE}" | ||
docker-compose -f "${DOCKER_COMPOSE_YAML}" up -d --force-recreate | ||
|
||
echo "Posix testing..." | ||
docker exec -i "${BENCHMARKING_CONTAINER}" script/posix/run.sh | ||
|
||
echo "Harvesting output..." | ||
docker cp "${BENCHMARKING_CONTAINER}:/output" "${REPO}/out-posix" | ||
|
||
echo "Cleaning up benchmark environment..." | ||
docker-compose -f "${DOCKER_COMPOSE_YAML}" down -v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean
apt-transport-https gnupg2 software-properties-common
.