Enhancements to papr tests

The PR contains several enhancements to our CI testing.

- enable lint testing on Fedora
- add Centos Atomic as test platform
- integration tests on run on the OS natively (uncontainerized)
- builds are done in containers
- inclusion of Vagrant file for local testing

Signed-off-by: baude <bbaude@redhat.com>

Closes: #18
Approved by: mheon
pull/49/head
baude 2017-11-03 14:37:22 -05:00 committed by Atomic Bot
parent bf8b9a37df
commit d2eda1a864
38 changed files with 440 additions and 337 deletions

114
.papr.sh
View File

@ -1,37 +1,101 @@
#!/bin/bash
set -xeuo pipefail
export GOPATH=$HOME/gopath
DIST=$(cat /etc/redhat-release | awk '{print $1}')
IMAGE=registry.fedoraproject.org/fedora:26
PACKAGER=dnf
if [[ ${DIST} != "Fedora" ]]; then
PACKAGER=yum
IMAGE=registry.centos.org/centos/centos:7
fi
if test -z "${INSIDE_CONTAINER:-}"; then
if [ -f /run/ostree-booted ]; then
# by default, the root LV on AH is only 3G, but we need a
# bit more for our tests
lvresize -r -L +4G atomicos/root
if [ ! -e /var/tmp/ostree-unlock-ovl.* ]; then
ostree admin unlock
fi
fi
# Restarting docker helps with permissions related to above.
systemctl restart docker
# somewhat mimic the spec conditional
source /etc/os-release
if [ "$ID" == fedora ]; then
PYTHON=python3
else
PYTHON=python
fi
docker run --rm \
--privileged \
-v $PWD:/go/src/github.com/projectatomic/libpod \
-v /etc/yum.repos.d:/etc/yum.repos.d.host:ro \
-v /:/host \
--workdir /go/src/github.com/projectatomic/libpod \
-e INSIDE_CONTAINER=1 \
-e PYTHON=$PYTHON \
${IMAGE} /go/src/github.com/projectatomic/libpod/.papr.sh
systemd-detect-virt
./test/test_runner.sh
exit 0
fi
export GOPATH=/go
export PATH=$HOME/gopath/bin:$PATH
export GOSRC=$HOME/gopath/src/github.com/projectatomic/libpod
export GOSRC=/$GOPATH/src/github.com/projectatomic/libpod
(mkdir -p $GOSRC && cd /code && cp -r . $GOSRC)
${PACKAGER} install -y \
bats \
btrfs-progs-devel \
bzip2 \
device-mapper-devel \
findutils \
git \
glib2-devel \
gnupg \
golang \
gpgme-devel \
libassuan-devel \
libseccomp-devel \
libselinux-devel \
skopeo-containers \
runc \
make \
ostree-devel \
python \
which\
golang-github-cpuguy83-go-md2man
dnf install -y \
bats \
btrfs-progs-devel \
bzip2 \
device-mapper-devel \
findutils \
git \
glib2-devel \
gnupg \
golang \
gpgme-devel \
libassuan-devel \
libseccomp-devel \
libselinux-devel \
skopeo-containers \
runc \
make \
ostree-devel \
python \
which
# PAPR adds a merge commit, for testing, which fails the
# short-commit-subject validation test, so tell git-validate.sh to only check
# up to, but not including, the merge commit.
export GITVALIDATE_TIP=$(cd $GOSRC; git log -2 --pretty='%H' | tail -n 1)
export TAGS="seccomp $($GOSRC/hack/btrfs_tag.sh) $($GOSRC/hack/libdm_tag.sh) $($GOSRC/hack/btrfs_installed_tag.sh) $($GOSRC/hack/ostree_tag.sh) $($GOSRC/hack/selinux_tag.sh)"
make -C $GOSRC binaries install.tools all gofmt localintegration testunit TAGS="${TAGS}"
#make -C $GOSRC lint
make gofmt TAGS="${TAGS}"
make testunit TAGS="${TAGS}"
make install.tools TAGS="${TAGS}"
# Only check lint and gitvalidation on more recent
# distros with updated git and tooling
if [[ ${PACKAGER} != "yum" ]]; then
HEAD=$GITVALIDATE_TIP make -C $GOSRC .gitvalidation TAGS="${TAGS}"
make lint
dnf install -y --installroot /host bats
fi
make TAGS="${TAGS}"
make TAGS="${TAGS}" install PREFIX=/host/usr
make TAGS="${TAGS}" test-binaries
if [[ ${PACKAGER} == "yum" ]]; then
# Install EPEL to get Bats
${PACKAGER} -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
${PACKAGER} install --downloadonly --downloaddir=/tmp bats
cd /host && rpm2cpio /tmp/bats*.rpm | cpio -ivd
fi

View File

@ -13,8 +13,14 @@ required: true
timeout: 45m
tests:
# mount yum repos to inherit injected mirrors from PAPR
- docker run --net=host --privileged -v /etc/yum.repos.d:/etc/yum.repos.d.host:ro
-v /tmp:/tmp -v /var/tmp:/var/tmp
-v $PWD:/code registry.fedoraproject.org/fedora:26 sh -c
"cp -fv /etc/yum.repos.d{.host/*.repo,} && /code/.papr.sh"
- CRIO_ROOT=/var/tmp/checkout KPOD_BINARY=/usr/bin/kpod CONMON_BINARY=/usr/libexec/crio/conmon PAPR=1 sh .papr.sh
---
inherit: true
host:
distro: centos/7/atomic/alpha
specs:
ram: 8192
context: centos/7/atomic/alpha

View File

@ -13,7 +13,9 @@ if [ ! -f ${LINTER} ]; then
exit 1
fi
PKGS=$(find . -type d -not -path . -a -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*' -a -not -iname 'hack' -a -not -iwholename '*.artifacts*' -a -not -iwholename '*contrib*' -a -not -iwholename '*test*' -a -not -iwholename '*logo*' -a -not -iwholename '*conmon*' -a -not -iwholename '*completions*' -a -not -iwholename '*docs*' -a -not -iwholename '*pause*')
PKGS=$(find . -type d -not -path . -a -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*' -a -not -iname 'hack' -a -not -iwholename '*.artifacts*' -a -not -iwholename '*contrib*' -a -not -iwholename '*test*' -a -not -iwholename '*logo*' -a -not -iwholename '*conmon*' -a -not -iwholename '*completions*' -a -not -iwholename '*docs*' -a -not -iwholename '*pause*' -a -not -iwholename './_output*')
echo $PKGS
# Execute the linter
${LINTER} \
@ -40,5 +42,6 @@ ${LINTER} \
--exclude='duplicate of.*_test.go.*\(dupl\)$'\
--exclude='cmd\/client\/.*\.go.*\(dupl\)$'\
--exclude='vendor\/.*'\
--exclude='kpod\/.*'\
--exclude='server\/seccomp\/.*\.go.*$'\
${PKGS[@]}

View File

@ -25,6 +25,10 @@ before_script:
- export PATH=$HOME/gopath/bin:$PATH
- export LD_LIBRARY_PATH=/usr/local/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
env:
global:
- TRAVIS=1
jobs:
include:
- stage: Build and Verify

View File

@ -1,5 +1,6 @@
GO ?= go
EPOCH_TEST_COMMIT ?= 2b74391
EPOCH_TEST_COMMIT ?= 5cfd7a3
HEAD ?= HEAD
PROJECT := github.com/projectatomic/libpod
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g")
@ -41,6 +42,8 @@ KPOD_LDFLAGS := -X main.kpodVersion=${KPOD_VERSION}
LDFLAGS := -ldflags '${BASE_LDFLAGS}'
LDFLAGS_KPOD := -ldflags '${BASE_LDFLAGS} ${KPOD_LDFLAGS}'
BOX="fedora_atomic"
all: binaries docs
default: help
@ -114,6 +117,9 @@ testunit:
localintegration: test-binaries
bash -i ./test/test_runner.sh ${TESTFLAGS}
vagrant-check:
BOX=$(BOX) sh ./vagrant.sh
binaries: conmon kpod
test-binaries: test/bin2img/bin2img test/copyimg/copyimg test/checkseccomp/checkseccomp
@ -151,13 +157,8 @@ uninstall:
done
.PHONY: .gitvalidation
# When this is running in travis, it will only check the travis commit range
.gitvalidation: .gopathok
ifeq ($(TRAVIS),true)
GIT_CHECK_EXCLUDE="./vendor" $(GOPATH)/bin/git-validation -q -run DCO,short-subject,dangling-whitespace
else
GIT_CHECK_EXCLUDE="./vendor" $(GOPATH)/bin/git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD
endif
GIT_CHECK_EXCLUDE="./vendor" $(GOPATH)/bin/git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..$(HEAD)
.PHONY: install.tools

35
Vagrantfile vendored Normal file
View File

@ -0,0 +1,35 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.provider "libvirt" do |libvirt, override|
libvirt.memory = 3096
libvirt.cpus = 3
libvirt.storage :file,
:type => 'qcow2'
end
config.vm.synced_folder ".", "/home/vagrant/sync", disabled: true
config.vm.synced_folder ".", "/home/vagrant/libpod", type: "rsync", rsync__exclude: ["_output"]
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.define "fedora_atomic" do |fedora_atomic|
fedora_atomic.vm.box = "fedora_atomic"
fedora_atomic.vm.box_url = "https://getfedora.org/atomic_vagrant_libvirt_latest"
end
config.vm.define "centos_atomic" do |centos_atomic|
centos_atomic.vm.box = "centos_atomic"
centos_atomic.vm.box_url = "https://ci.centos.org/artifacts/sig-atomic/centos-continuous/images/cloud/latest/images/centos-atomic-host-7-vagrant-libvirt.box"
end
config.vm.define "fedora_cloud" do |fedora_cloud|
fedora_cloud.vm.box = "fedora/26-cloud-base"
end
end

View File

@ -411,14 +411,17 @@ func (c *Container) Attach(noStdin bool, keys string, attached chan<- bool) erro
resize := make(chan remotecommand.TerminalSize)
defer close(resize)
err = c.attachContainerSocket(resize, noStdin, detachKeys, attached)
if err != nil {
return err
}
return err
// TODO
// Re-enable this when mheon is done wth it
//if err != nil {
// return err
//}
//c.ContainerStateToDisk(c)
return nil
//return err
}
// Mount mounts a container's filesystem on the host

View File

@ -44,7 +44,7 @@ func (r *Runtime) getLayerID(id string) (string, error) {
return toLayer, nil
}
func (r *Runtime) getLayerParent(layerID string) (string, error) {
func (r *Runtime) getLayerParent(layerID string) (string, error) { //nolint
layer, err := r.store.Layer(layerID)
if err != nil {
return "", err

View File

@ -256,18 +256,18 @@ func (r *OCIRuntime) createContainer(ctr *Container, cgroupParent string) error
// updateContainerStatus retrieves the current status of the container from the
// runtime
func (r *OCIRuntime) updateContainerStatus(ctr *Container) error {
// remove nolint when implemented
func (r *OCIRuntime) updateContainerStatus(ctr *Container) error { //nolint
return ErrNotImplemented
}
// startContainer starts the given container
func (r *OCIRuntime) startContainer(ctr *Container) error {
// remove nolint when function is complete
func (r *OCIRuntime) startContainer(ctr *Container) error { //nolint
// TODO: streams should probably *not* be our STDIN/OUT/ERR - redirect to buffers?
if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, r.path, "start", ctr.ID()); err != nil {
return err
}
err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, r.path, "start", ctr.ID())
// TODO record start time in container struct
return nil
return err
}

View File

@ -223,6 +223,7 @@ func (r *Runtime) removeMultipleContainers(containers []storage.Container) error
}
// ContainerConfigToDisk saves a container's nonvolatile configuration to disk
func (r *Runtime) containerConfigToDisk(ctr *Container) error {
// remove nolint when implemented
func (r *Runtime) containerConfigToDisk(ctr *Container) error { //nolint
return ErrNotImplemented
}

View File

@ -118,7 +118,7 @@ type Image struct {
Name string
ID string
fqname string
hasImageLocal bool
hasImageLocal bool //nolint
runtime *Runtime
Registry string
ImageName string
@ -359,10 +359,7 @@ func (k *Image) HasLatest() (bool, error) {
return false, err
}
_, _, err = pullRef.(types.ImageSource).GetManifest()
if err != nil {
return false, err
}
return false, nil
return false, err
}
// Pull is a wrapper function to pull and image
@ -1155,7 +1152,8 @@ func ParseImageNames(names []string) (tags, digests []string, err error) {
return tags, digests, nil
}
func annotations(manifest []byte, manifestType string) map[string]string {
// Remove nolint when used
func annotations(manifest []byte, manifestType string) map[string]string { //nolint
annotations := make(map[string]string)
switch manifestType {
case ociv1.MediaTypeImageManifest:

View File

@ -525,7 +525,7 @@ func GetImageService(store storage.Store, defaultTransport string, insecureRegis
is := &imageService{
store: store,
defaultTransport: defaultTransport,
indexConfigs: make(map[string]*indexInfo, 0),
indexConfigs: make(map[string]*indexInfo),
insecureRegistryCIDRs: make([]*net.IPNet, 0),
registries: cleanRegistries,
}

View File

@ -7,13 +7,21 @@ INTEGRATION_ROOT=$(dirname "$(readlink -f "$BASH_SOURCE")")
TESTDATA="${INTEGRATION_ROOT}/testdata"
# Root directory of the repository.
CRIO_ROOT=${CRIO_ROOT:-$(cd "$INTEGRATION_ROOT/../.."; pwd -P)}
if [[ ! -z "$CRIO_ROOT" ]]; then
CRIO_ROOT=${CRIO_ROOT}
elif [[ ! -z "$TRAVIS" ]]; then
CRIO_ROOT="/go/src/github.com/projectatomic/libpod"
elif [[ ! -z "$PAPR" ]]; then
CRIO_ROOT="/var/tmp/checkout"
else
CRIO_ROOT=$(cd "$INTEGRATION_ROOT/../.."; pwd -P)}
fi
KPOD_BINARY=${KPOD_BINARY:-${CRIO_ROOT}/libpod/bin/kpod}
KPOD_BINARY=${KPOD_BINARY:-${CRIO_ROOT}/bin/kpod}
# Path of the conmon binary.
CONMON_BINARY=${CONMON_BINARY:-${CRIO_ROOT}/libpod/bin/conmon}
CONMON_BINARY=${CONMON_BINARY:-${CRIO_ROOT}/bin/conmon}
# Path of the default seccomp profile.
SECCOMP_PROFILE=${SECCOMP_PROFILE:-${CRIO_ROOT}/libpod/seccomp.json}
SECCOMP_PROFILE=${SECCOMP_PROFILE:-${CRIO_ROOT}/seccomp.json}
# Name of the default apparmor profile.
APPARMOR_PROFILE=${APPARMOR_PROFILE:-crio-default}
# Runtime
@ -33,13 +41,13 @@ BOOT_CONFIG_FILE_PATH=${BOOT_CONFIG_FILE_PATH:-/boot/config-`uname -r`}
# Path of apparmor parameters file.
APPARMOR_PARAMETERS_FILE_PATH=${APPARMOR_PARAMETERS_FILE_PATH:-/sys/module/apparmor/parameters/enabled}
# Path of the bin2img binary.
BIN2IMG_BINARY=${BIN2IMG_BINARY:-${CRIO_ROOT}/libpod/test/bin2img/bin2img}
BIN2IMG_BINARY=${BIN2IMG_BINARY:-${CRIO_ROOT}/test/bin2img/bin2img}
# Path of the copyimg binary.
COPYIMG_BINARY=${COPYIMG_BINARY:-${CRIO_ROOT}/libpod/test/copyimg/copyimg}
COPYIMG_BINARY=${COPYIMG_BINARY:-${CRIO_ROOT}/test/copyimg/copyimg}
# Path of tests artifacts.
ARTIFACTS_PATH=${ARTIFACTS_PATH:-${CRIO_ROOT}/libpod/.artifacts}
ARTIFACTS_PATH=${ARTIFACTS_PATH:-${CRIO_ROOT}/.artifacts}
# Path of the checkseccomp binary.
CHECKSECCOMP_BINARY=${CHECKSECCOMP_BINARY:-${CRIO_ROOT}/libpod/test/checkseccomp/checkseccomp}
CHECKSECCOMP_BINARY=${CHECKSECCOMP_BINARY:-${CRIO_ROOT}/test/checkseccomp/checkseccomp}
# XXX: This is hardcoded inside cri-o at the moment.
DEFAULT_LOG_PATH=/var/log/crio/pods
# Cgroup manager to be used
@ -51,7 +59,12 @@ PIDS_LIMIT=${PIDS_LIMIT:-1024}
# Log size max limit
LOG_SIZE_MAX_LIMIT=${LOG_SIZE_MAX_LIMIT:--1}
TESTDIR=$(mktemp -d)
if [[ ! -d "/test.dir" ]]; then
mkdir /test.dir
fi
TESTDIR=$(mktemp -p /test.dir -d)
#mount -t tmpfs tmpfs ${TESTDIR}
# kpod pull needs a configuration file for shortname pulls
export REGISTRIES_CONFIG_PATH="$INTEGRATION_ROOT/registries.conf"

View File

@ -9,9 +9,7 @@ function teardown() {
ALPINE="docker.io/library/alpine:latest"
@test "create a container based on local image" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest
echo "$output"
[ "$status" -eq 0 ]
${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest
run ${KPOD_BINARY} ${KPOD_OPTIONS} create docker.io/library/busybox:latest ls
echo "$output"
[ "$status" -eq 0 ]

View File

@ -9,13 +9,13 @@ function teardown() {
}
@test "test diff of image and parent" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS diff $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS diff $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
}
@ -27,14 +27,14 @@ function teardown() {
}
@test "test diff with json output" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
# run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} diff --format json $IMAGE | python -m json.tool"
run ${KPOD_BINARY} $KPOD_OPTIONS diff --format json $IMAGE
# run bash -c bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} diff --format json $IMAGE | python -m json.tool"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS diff --format json $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
}

View File

@ -9,20 +9,20 @@ function teardown() {
}
@test "kpod export output flag" {
skip "Test needs to be converted to kpod run"
skip "Test needs to be converted to kpod run bash -c"
start_crio
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run crioctl image pull "$IMAGE"
run bash -c crioctl image pull "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs

View File

@ -9,72 +9,64 @@ function teardown() {
}
@test "kpod history default" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} history $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod history with Go template format" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} history --format "{{.ID}} {{.Created}}" $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history --format "{{.ID}} {{.Created}}" $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod history human flag" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} history --human=false $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history --human=false $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod history quiet flag" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} history -q $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history -q $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod history no-trunc flag" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} history --no-trunc $IMAGE
${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history --no-trunc $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod history json flag" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} history --format json $IMAGE | python -m json.tool"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
}

View File

@ -2,46 +2,41 @@
load helpers
IMAGE="debian:6.0.10"
IMAGE="busybox"
function teardown() {
cleanup_test
}
@test "kpod images" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE}
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} images
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} images
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE}
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod images test valid json" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE}
run ${KPOD_BINARY} ${KPOD_OPTIONS} images --format json
echo "$output" | python -m json.tool
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE}
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod images check name json output" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} images --format json
echo "$output"
${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE}
run ${KPOD_BINARY} ${KPOD_OPTIONS} images --format json
[ "$status" -eq 0 ]
name=$(echo $output | python -c 'import sys; import json; print(json.loads(sys.stdin.read())[0])["names"][0]')
[ "$name" = "docker.io/library/${IMAGE}" ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE}
[ "$name" == "docker.io/library/${IMAGE}:latest" ]
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
}

View File

@ -9,30 +9,30 @@ function teardown() {
}
@test "kpod import with source and reference" {
skip "Test needs to be converted to kpod run"
skip "Test needs to be converted to kpod run bash -c"
start_crio
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run crioctl image pull "$IMAGE"
run bash -c crioctl image pull "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} import container.tar imported-image
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import container.tar imported-image
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} images
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} images
echo "$output"
[ "$status" -eq 0 ]
images="$output"
run grep "imported-image" <<< "$images"
run bash -c grep "imported-image" <<< "$images"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -42,30 +42,30 @@ function teardown() {
}
@test "kpod import without reference" {
skip "Test needs to be converted to kpod run"
skip "Test needs to be converted to kpod run bash -c"
start_crio
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run crioctl image pull "$IMAGE"
run bash -c crioctl image pull "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} import container.tar
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import container.tar
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} images
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} images
echo "$output"
[ "$status" -eq 0 ]
images="$output"
run grep "<none>" <<< "$images"
run bash -c grep "<none>" <<< "$images"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -75,30 +75,30 @@ function teardown() {
}
@test "kpod import with message flag" {
skip "Test needs to be converted to kpod run"
skip "Test needs to be converted to kpod run bash -c"
start_crio
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run crioctl image pull "$IMAGE"
run bash -c crioctl image pull "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} import --message "importing container test message" container.tar imported-image
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import --message "importing container test message" container.tar imported-image
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} history imported-image
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history imported-image
echo "$output"
[ "$status" -eq 0 ]
history="$output"
run grep "importing container test message" <<< "$history"
run bash -c grep "importing container test message" <<< "$history"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -108,30 +108,30 @@ function teardown() {
}
@test "kpod import with change flag" {
skip "Test needs to be converted to kpod run"
skip "Test needs to be converted to kpod run bash -c"
start_crio
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
run crioctl image pull "$IMAGE"
run bash -c crioctl image pull "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} import --change "CMD=/bin/bash" container.tar imported-image
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import --change "CMD=/bin/bash" container.tar imported-image
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} inspect imported-image
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} inspect imported-image
echo "$output"
[ "$status" -eq 0 ]
inspect="$output"
run grep "/bin/bash" <<< "$inspect"
run bash -c grep "/bin/bash" <<< "$inspect"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs

View File

@ -2,20 +2,18 @@
load helpers
IMAGE="redis:alpine"
IMAGE="docker.io/library/busybox:latest"
function teardown() {
cleanup_test
}
@test "kpod inspect image" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE}
run bash -c "${KPOD_BINARY} $KPOD_OPTIONS inspect ${IMAGE} | python -m json.tool"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE}
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
}
@ -28,31 +26,27 @@ function teardown() {
}
@test "kpod inspect with format" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS inspect --format {{.ID}} ${IMAGE}
${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE}
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS inspect --format {{.ID}} ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
inspectOutput="$output"
run ${KPOD_BINARY} $KPOD_OPTIONS images --no-trunc --quiet ${IMAGE}
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS images --no-trunc --quiet ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
[ "$output" = "$inspectOutput" ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE}
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod inspect specified type" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE}
run bash -c "${KPOD_BINARY} $KPOD_OPTIONS inspect --type image ${IMAGE} | python -m json.tool"
echo "$output"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE}
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
}

View File

@ -27,7 +27,7 @@ function start_sleep_container () {
${KPOD_BINARY} ${KPOD_OPTIONS} ps -a
${KPOD_BINARY} ${KPOD_OPTIONS} logs "$ctr_id"
crioctl ctr status --id "$ctr_id"
run ${KPOD_BINARY} ${KPOD_OPTIONS} kill "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} kill "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -44,7 +44,7 @@ function start_sleep_container () {
${KPOD_BINARY} ${KPOD_OPTIONS} ps -a
${KPOD_BINARY} ${KPOD_OPTIONS} logs "$ctr_id"
crioctl ctr status --id "$ctr_id"
run ${KPOD_BINARY} ${KPOD_OPTIONS} kill -s TERM "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} kill -s TERM "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -62,7 +62,7 @@ function start_sleep_container () {
${KPOD_BINARY} ${KPOD_OPTIONS} logs "$ctr_id"
crioctl ctr status --id "$ctr_id"
${KPOD_BINARY} ${KPOD_OPTIONS} ps -a
run ${KPOD_BINARY} ${KPOD_OPTIONS} kill "k8s_container999_podsandbox1_redhat.test.crio_redhat-test-crio_1"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} kill "k8s_container999_podsandbox1_redhat.test.crio_redhat-test-crio_1"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -78,7 +78,7 @@ function start_sleep_container () {
crioctl ctr status --id "$ctr_id"
${KPOD_BINARY} ${KPOD_OPTIONS} logs "$ctr_id"
crioctl ctr status --id "$ctr_id"
run ${KPOD_BINARY} ${KPOD_OPTIONS} kill -s foobar "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} kill -s foobar "$ctr_id"
echo "$output"
[ "$status" -ne 0 ]
cleanup_ctrs

View File

@ -9,71 +9,71 @@ function teardown() {
}
@test "kpod load input flag" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar
echo "$output"
[ "$status" -eq 0 ]
rm -f alpine.tar
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod load oci-archive image" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar
echo "$output"
[ "$status" -eq 0 ]
rm -f alpine.tar
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
[ "$status" -eq 0 ]
}
@test "kpod load oci-archive image with signature-policy" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
[ "$status" -eq 0 ]
cp /etc/containers/policy.json /tmp
run ${KPOD_BINARY} ${KPOD_OPTIONS} load --signature-policy /tmp/policy.json -i alpine.tar
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load --signature-policy /tmp/policy.json -i alpine.tar
echo "$output"
[ "$status" -eq 0 ]
rm -f /tmp/policy.json
rm -f alpine.tar
run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE
[ "$status" -eq 0 ]
}
@test "kpod load using quiet flag" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} load -q -i alpine.tar
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load -q -i alpine.tar
echo "$output"
[ "$status" -eq 0 ]
rm -f alpine.tar
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
[ "$status" -eq 0 ]
}

View File

@ -22,7 +22,7 @@ function teardown() {
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS logs "$ctr_id"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS logs "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -44,7 +44,7 @@ function teardown() {
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS logs --tail 3 $ctr_id
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS logs --tail 3 $ctr_id
echo "$output"
lines=$(echo "$output" | wc -l)
[ "$status" -eq 0 ]
@ -68,7 +68,7 @@ function teardown() {
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS logs --since 2017-08-07T10:10:09.056611202-04:00 $ctr_id
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS logs --since 2017-08-07T10:10:09.056611202-04:00 $ctr_id
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs

View File

@ -22,17 +22,17 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id
echo "$output"
echo ${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id
[ "$status" -eq 0 ]
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} mount --notruncate | grep $ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} unmount $ctr_id
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unmount $ctr_id
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id
echo "$output"
[ "$status" -eq 0 ]
root="$output"
@ -40,7 +40,7 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
touch $root/foobar
run ${KPOD_BINARY} ${KPOD_OPTIONS} unmount $ctr_id
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unmount $ctr_id
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs

View File

@ -33,13 +33,13 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods
@ -63,13 +63,13 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods
@ -92,13 +92,13 @@ function teardown() {
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} pause "k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pause "k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods
@ -122,22 +122,22 @@ function teardown() {
echo "$output"
id="$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rm "$id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rm "$id"
echo "$output"
[ "$status" -eq 1 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rm --force "$id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rm --force "$id"
echo "$output"
[ "$status" -eq 1 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rm "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rm "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods
@ -157,16 +157,16 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_id"
echo "$output"
[ "$status" -eq 1 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods

View File

@ -5,7 +5,7 @@ load helpers
IMAGE="redis:alpine"
@test "kpod ps with no containers" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps
echo "$output"
[ "$status" -eq 0 ]
}
@ -27,7 +27,7 @@ IMAGE="redis:alpine"
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -48,10 +48,10 @@ IMAGE="redis:alpine"
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps --all
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps --all
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -72,10 +72,10 @@ IMAGE="redis:alpine"
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a -s
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a -s
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --size
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --size
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -96,10 +96,10 @@ IMAGE="redis:alpine"
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a -q
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a -q
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --quiet
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --quiet
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -120,10 +120,10 @@ IMAGE="redis:alpine"
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps --latest
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps --latest
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -l
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -l
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -144,10 +144,10 @@ IMAGE="redis:alpine"
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps --last 2
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps --last 2
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -n 2
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -n 2
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -168,7 +168,7 @@ IMAGE="redis:alpine"
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --no-trunc
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --no-trunc
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -188,10 +188,10 @@ IMAGE="redis:alpine"
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --ns
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --ns
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps --all --namespace
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps --all --namespace
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -253,7 +253,7 @@ IMAGE="redis:alpine"
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --format "table {{.ID}} {{.Image}} {{.Labels}}"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --format "table {{.ID}} {{.Image}} {{.Labels}}"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -274,7 +274,7 @@ IMAGE="redis:alpine"
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter ancestor=${IMAGE}
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter ancestor=${IMAGE}
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -296,7 +296,7 @@ IMAGE="redis:alpine"
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -318,7 +318,7 @@ IMAGE="redis:alpine"
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter status=running
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter status=running
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs

View File

@ -12,7 +12,7 @@ function teardown() {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi debian:6.0.10
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi debian:6.0.10
echo "$output"
[ "$status" -eq 0 ]
}
@ -21,7 +21,7 @@ function teardown() {
run ${KPOD_BINARY} $KPOD_OPTIONS pull debian
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi debian
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi debian
echo "$output"
[ "$status" -eq 0 ]
}
@ -30,7 +30,7 @@ function teardown() {
run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora:rawhide
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide
echo "$output"
[ "$status" -eq 0 ]
}
@ -39,7 +39,7 @@ function teardown() {
run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora
echo "$output"
[ "$status" -eq 0 ]
}
@ -48,7 +48,7 @@ function teardown() {
run ${KPOD_BINARY} $KPOD_OPTIONS pull alpine@sha256:1072e499f3f655a032e88542330cf75b02e7bdf673278f701d7ba61629ee3ebe
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi alpine:latest
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi alpine:latest
echo "$output"
[ "$status" -eq 0 ]
}
@ -63,7 +63,7 @@ function teardown() {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:latest
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:latest
echo "$output"
[ "$status" -eq 0 ]
}
@ -72,7 +72,7 @@ function teardown() {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:6.0.10
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:6.0.10
echo "$output"
[ "$status" -eq 0 ]
}
@ -81,57 +81,57 @@ function teardown() {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alp.tar alpine
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alp.tar alpine
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker-archive:alp.tar
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker-archive:alp.tar
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
echo "$output"
[ "$status" -eq 0 ]
rm -f alp.tar
}
@test "kpod pull from oci-archive" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} save --format oci-archive -o oci-alp.tar alpine
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save --format oci-archive -o oci-alp.tar alpine
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull oci-archive:oci-alp.tar
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull oci-archive:oci-alp.tar
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
echo "$output"
[ "$status" -eq 0 ]
rm -f oci-alp.tar
}
@test "kpod pull from local directory" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine
echo "$output"
[ "$status" -eq 0 ]
run mkdir test_pull_dir
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} push alpine dir:test_pull_dir
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} push alpine dir:test_pull_dir
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull dir:test_pull_dir
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull dir:test_pull_dir
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi test_pull_dir
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi test_pull_dir
echo "$output"
[ "$status" -eq 0 ]
rm -rf test_pull_dir

View File

@ -9,20 +9,19 @@ function teardown() {
}
@test "kpod push to containers/storage" {
skip "Issues with bash, skipping"
echo # Pull down the image: it gets the name $IMAGE.
run ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug pull "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug pull $IMAGE
echo # Push the image right back into storage: it now has two names.
run ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug push "$IMAGE" containers-storage:busybox:test
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug push "$IMAGE" containers-storage:busybox:test
echo "$output"
[ "$status" -eq 0 ]
echo # Try to remove it using the first name. Should be refused.
run ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi "$IMAGE"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi $IMAGE
echo "$output"
[ "$status" -ne 0 ]
echo # Try to remove it using the second name. Should also be refused.
run ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi busybox:test
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi busybox:test
echo "$output"
[ "$status" -ne 0 ]
echo # Force removal despite having multiple names. Should succeed.
@ -32,59 +31,48 @@ function teardown() {
}
@test "kpod push to directory" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
run mkdir /tmp/busybox
echo "$output"
[ "$status" -eq 0 ]
${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE"
mkdir /tmp/busybox
run ${KPOD_BINARY} $KPOD_OPTIONS push "$IMAGE" dir:/tmp/busybox
echo "$output"
[ "$status" -eq 0 ]
rm -rf /tmp/busybox
run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod push to docker archive" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE"
run ${KPOD_BINARY} $KPOD_OPTIONS push "$IMAGE" docker-archive:/tmp/busybox-archive:1.26
echo "$output"
echo "--->"
[ "$status" -eq 0 ]
rm /tmp/busybox-archive
run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod push to oci-archive without compression" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE"
run ${KPOD_BINARY} $KPOD_OPTIONS push "$IMAGE" oci-archive:/tmp/oci-busybox.tar:alpine
echo "$output"
[ "$status" -eq 0 ]
rm -f /tmp/oci-busybox.tar
run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
}
@test "kpod push without signatures" {
run ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
run mkdir /tmp/busybox
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS push --remove-signatures "$IMAGE" dir:/tmp/busybox
${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE"
mkdir /tmp/busybox
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS push --remove-signatures "$IMAGE" dir:/tmp/busybox
echo "$output"
[ "$status" -eq 0 ]
rm -rf /tmp/busybox
run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE"
echo "$output"
[ "$status" -eq 0 ]
}

View File

@ -11,7 +11,7 @@ function teardown() {
@test "kpod rename successful" {
skip "Test needs to be converted to kpod run"
start_crio
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run crioctl pod run --config "$TESTDATA"/sandbox_config.json
@ -21,10 +21,10 @@ function teardown() {
run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id"
ctr_id="$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rename "$ctr_id" "$NEW_NAME"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rename "$ctr_id" "$NEW_NAME"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS inspect "$ctr_id" --format {{.Name}}
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS inspect "$ctr_id" --format {{.Name}}
echo "$output"
[ "$status" -eq 0 ]
[ "$output" == "$NEW_NAME" ]

View File

@ -25,7 +25,7 @@ function teardown() {
run crioctl ctr stop --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rm "$ctr_id"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods
@ -46,7 +46,7 @@ function teardown() {
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rm "$ctr_id"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm "$ctr_id"
echo "$output"
[ "$status" -ne 0 ]
cleanup_ctrs
@ -65,7 +65,7 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} $KPOD_OPTIONS rm -f "$ctr_id"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm -f "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods
@ -86,7 +86,7 @@ function teardown() {
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} $KPOD_OPTIONS rm -f "$ctr_id"
run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm -f "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods

View File

@ -8,29 +8,34 @@ ALPINE="docker.io/library/alpine:latest"
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} run docker.io/library/busybox:latest ls
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run docker.io/library/busybox:latest ls
echo "$output"
[ "$status" -eq 0 ]
}
@test "run a container based on a remote image" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} ls
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} ls
echo "$output"
[ "$status" -eq 0 ]
}
@test "run selinux test" {
if [ ! -e /usr/sbin/selinuxenabled ] || [ ! /usr/sbin/selinuxenabled ]; then
skip "SELinux not enabled"
fi
firstLabel=$(${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} cat /proc/self/attr/current)
run ${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} cat /proc/self/attr/current
echo "$output"
[ "$status" -eq 0 ]
[ "$output" != "${firstLabel}" ]
firstLabel=$output
run ${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} cat /proc/self/attr/current
echo "$output"
[ "$output" != "${firstLabel}" ]
}
@test "run selinux grep test" {
skip "Until console issues worked out"
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -t -i --security-opt label=level:s0:c1,c2 ${ALPINE} cat /proc/self/attr/current | grep s0:c1,c2"
echo "$output"
[ "$status" -eq 0 ]
@ -38,20 +43,19 @@ ALPINE="docker.io/library/alpine:latest"
}
@test "run capabilities test" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-add all ${ALPINE} cat /proc/self/status
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-add all ${ALPINE} cat /proc/self/status
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-add sys_admin ${ALPINE} cat /proc/self/status
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-add sys_admin ${ALPINE} cat /proc/self/status
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-drop all ${ALPINE} cat /proc/self/status
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-drop all ${ALPINE} cat /proc/self/status
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-drop setuid ${ALPINE} cat /proc/self/status
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-drop setuid ${ALPINE} cat /proc/self/status
echo "$output"
[ "$status" -eq 0 ]

View File

@ -12,10 +12,10 @@ function teardown() {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
rm -f alpine.tar
@ -24,10 +24,10 @@ function teardown() {
@test "kpod save oci flag" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
[ "$status" -eq 0 ]
rm -f alpine.tar
}
@ -36,10 +36,10 @@ function teardown() {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} save > alpine.tar $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save > alpine.tar $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
rm -f alpine.tar
@ -49,10 +49,10 @@ function teardown() {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} save -q -o alpine.tar $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -q -o alpine.tar $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE
echo "$output"
[ "$status" -eq 0 ]
rm -f alpine.tar

View File

@ -20,7 +20,7 @@ function teardown() {
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -39,7 +39,7 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -58,7 +58,7 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --all
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --all
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
@ -80,7 +80,7 @@ function teardown() {
run crioctl ctr start --id "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --format {{.ID}} "$ctr_id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --format {{.ID}} "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
# once ps is implemented, run ps -q and see if that equals the output from above

View File

@ -27,7 +27,7 @@ function teardown() {
echo "$output"
id="$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$id"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods
@ -52,7 +52,7 @@ function teardown() {
[ "$status" -eq 0 ]
ctr_name=$(python -c 'import json; import sys; print json.load(sys.stdin)["crio_annotations"]["io.kubernetes.cri-o.Name"]' <<< "$output")
echo container name is \""$ctr_name"\"
run ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_name"
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_name"
echo "$output"
[ "$status" -eq 0 ]
cleanup_pods

View File

@ -9,42 +9,42 @@ function teardown() {
}
@test "kpod tag with shortname:latest" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar:latest
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar:latest
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:latest
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:latest
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:latest
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:latest
[ "$status" -eq 0 ]
}
@test "kpod tag with shortname" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:latest
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:latest
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:latest
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:latest
[ "$status" -eq 0 ]
}
@test "kpod tag with shortname:tag" {
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar:v
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar:v
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:v
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:v
echo "$output"
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:v
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:v
[ "$status" -eq 0 ]
}

View File

@ -7,7 +7,7 @@ function teardown() {
}
@test "kpod version test" {
run ${KPOD_BINARY} version
run bash -c ${KPOD_BINARY} version
echo "$output"
[ "$status" -eq 0 ]
}

View File

@ -26,7 +26,7 @@ function container_start() {
@test "wait on a bogus container" {
skip "Needs to be converted to kpod run"
start_crio
run ${KPOD_BINARY} ${KPOD_OPTIONS} wait 12343
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} wait 12343
echo $output
[ "$status" -eq 1 ]
stop_crio
@ -34,7 +34,7 @@ function container_start() {
@test "wait on a stopped container" {
skip "Needs to be converted to kpod run"
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest
echo $output
[ "$status" -eq 0 ]
start_crio
@ -43,7 +43,7 @@ function container_start() {
ctr_id=$(container_create_from_template "test-CTR" "docker.io/library/busybox:latest" '["ls"]' "${pod_id}")
echo $ctr_id
container_start $ctr_id
run ${KPOD_BINARY} ${KPOD_OPTIONS} wait $ctr_id
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} wait $ctr_id
[ "$status" -eq 0 ]
cleanup_ctrs
cleanup_pods
@ -52,7 +52,7 @@ function container_start() {
@test "wait on a sleeping container" {
skip "Needs to be converted to kpod run"
run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest
echo $output
[ "$status" -eq 0 ]
start_crio
@ -63,7 +63,7 @@ function container_start() {
run container_start $ctr_id
echo $output
[ "$status" -eq 0 ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} wait $ctr_id
run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} wait $ctr_id
echo $output
[ "$status" -eq 0 ]
cleanup_ctrs

View File

@ -12,7 +12,11 @@ function execute() {
}
# Tests to run. Defaults to all.
TESTS=${@:-.}
if [[ -z "${TESTS}" ]]; then
TESTS=${@:-.}
else
TESTS=$TESTS
fi
# Run the tests.
execute time bats --tap $TESTS