From 5d86f1f110603e358b947d8467c7f0e60fae9d2b Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 19 Jan 2017 18:47:50 +0100 Subject: [PATCH] test: enable tests in Travis Signed-off-by: Antonio Murdaca --- test/apparmor.bats | 25 ----------------------- test/ctr.bats | 45 ----------------------------------------- test/network.bats | 15 -------------- test/pod.bats | 45 ----------------------------------------- test/restore.bats | 5 ----- test/seccomp.bats | 50 ---------------------------------------------- 6 files changed, 185 deletions(-) diff --git a/test/apparmor.bats b/test/apparmor.bats index 480acb9f..014d3257 100644 --- a/test/apparmor.bats +++ b/test/apparmor.bats @@ -9,11 +9,6 @@ function teardown() { # 1. test running with loading the default apparmor profile. # test that we can run with the default apparmor profile which will not block touching a file in `.` @test "load default apparmor profile and run a container with it" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires apparmor, so skip this test if apparmor is not enabled. enabled=$(is_apparmor_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -46,11 +41,6 @@ function teardown() { # 2. test running with loading a specific apparmor profile as ocid default apparmor profile. # test that we can run with a specific apparmor profile which will block touching a file in `.` as ocid default apparmor profile. @test "load a specific apparmor profile as default apparmor and run a container with it" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires apparmor, so skip this test if apparmor is not enabled. enabled=$(is_apparmor_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -85,11 +75,6 @@ function teardown() { # 3. test running with loading a specific apparmor profile but not as ocid default apparmor profile. # test that we can run with a specific apparmor profile which will block touching a file in `.` @test "load default apparmor profile and run a container with another apparmor profile" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires apparmor, so skip this test if apparmor is not enabled. enabled=$(is_apparmor_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -124,11 +109,6 @@ function teardown() { # 4. test running with wrong apparmor profile name. # test that we can will fail when running a ctr with rong apparmor profile name. @test "run a container with wrong apparmor profile name" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires apparmor, so skip this test if apparmor is not enabled. enabled=$(is_apparmor_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -157,11 +137,6 @@ function teardown() { # 5. test running with default apparmor profile unloaded. # test that we can will fail when running a ctr with rong apparmor profile name. @test "run a container after unloading default apparmor profile" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires apparmor, so skip this test if apparmor is not enabled. enabled=$(is_apparmor_enabled) if [[ "$enabled" -eq 0 ]]; then diff --git a/test/ctr.bats b/test/ctr.bats index 257c43c2..ba92f0f7 100644 --- a/test/ctr.bats +++ b/test/ctr.bats @@ -7,11 +7,6 @@ function teardown() { } @test "ctr remove" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -39,11 +34,6 @@ function teardown() { } @test "ctr lifecycle" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -111,11 +101,6 @@ function teardown() { # regression test for #127 @test "ctrs status for a pod" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -143,11 +128,6 @@ function teardown() { } @test "ctr list filtering" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json --name pod1 echo "$output" @@ -246,11 +226,6 @@ function teardown() { } @test "ctr list label filtering" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -299,11 +274,6 @@ function teardown() { } @test "ctr metadata in list & status" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -334,11 +304,6 @@ function teardown() { } @test "ctr execsync" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -367,11 +332,6 @@ function teardown() { } @test "ctr execsync failure" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -394,11 +354,6 @@ function teardown() { } @test "ctr stop idempotent" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" diff --git a/test/network.bats b/test/network.bats index 419d4f52..0deea5e2 100644 --- a/test/network.bats +++ b/test/network.bats @@ -3,11 +3,6 @@ load helpers @test "Check for valid pod netns CIDR" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - if [ ! -f "$OCID_CNI_PLUGIN/bridge" ]; then skip "missing CNI bridge plugin, please install it" fi @@ -32,11 +27,6 @@ load helpers } @test "Ping pod from the host" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - if [ ! -f "$OCID_CNI_PLUGIN/bridge" ]; then skip "missing CNI bridge plugin, please install it" fi @@ -61,11 +51,6 @@ load helpers } @test "Ping pod from another pod" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - if [ ! -f "$OCID_CNI_PLUGIN/bridge" ]; then skip "missing CNI bridge plugin, please install it" fi diff --git a/test/pod.bats b/test/pod.bats index 4331fcdb..a805e0b9 100644 --- a/test/pod.bats +++ b/test/pod.bats @@ -8,11 +8,6 @@ function teardown() { # PR#59 @test "pod release name on remove" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -41,11 +36,6 @@ function teardown() { } @test "pod remove" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -67,11 +57,6 @@ function teardown() { } @test "pod list filtering" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json -name pod1 --label "a=b" --label "c=d" --label "e=f" echo "$output" @@ -161,11 +146,6 @@ function teardown() { } @test "pod metadata in list & status" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -195,11 +175,6 @@ function teardown() { } @test "pass pod sysctls to runtime" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -235,11 +210,6 @@ function teardown() { } @test "pod stop idempotent" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -258,11 +228,6 @@ function teardown() { } @test "pod remove idempotent" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -281,11 +246,6 @@ function teardown() { } @test "pod stop idempotent with ctrs already stopped" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -308,11 +268,6 @@ function teardown() { } @test "restart ocid and still get pod status" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" diff --git a/test/restore.bats b/test/restore.bats index 5d36e284..6e345c34 100644 --- a/test/restore.bats +++ b/test/restore.bats @@ -7,11 +7,6 @@ function teardown() { } @test "ocid restore" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - start_ocid run ocic pod run --config "$TESTDATA"/sandbox_config.json echo "$output" diff --git a/test/seccomp.bats b/test/seccomp.bats index ecfbaaf4..97ac125d 100644 --- a/test/seccomp.bats +++ b/test/seccomp.bats @@ -9,11 +9,6 @@ function teardown() { # 1. test running with ctr unconfined # test that we can run with a syscall which would be otherwise blocked @test "ctr seccomp profiles unconfined" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires seccomp, so skip this test if seccomp is not enabled. enabled=$(is_seccomp_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -50,11 +45,6 @@ function teardown() { # 2. test running with ctr runtime/default # test that we cannot run with a syscall blocked by the default seccomp profile @test "ctr seccomp profiles runtime/default" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires seccomp, so skip this test if seccomp is not enabled. enabled=$(is_seccomp_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -91,11 +81,6 @@ function teardown() { # 3. test running with ctr wrong profile name @test "ctr seccomp profiles wrong profile name" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires seccomp, so skip this test if seccomp is not enabled. enabled=$(is_seccomp_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -127,11 +112,6 @@ function teardown() { # TODO(runcom): need https://issues.k8s.io/36997 # 4. test running with ctr localhost/profile_name @test "ctr seccomp profiles localhost/profile_name" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires seccomp, so skip this test if seccomp is not enabled. enabled=$(is_seccomp_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -152,11 +132,6 @@ function teardown() { # pod -> runtime/default # result: fail chmod @test "ctr seccomp profiles falls back to pod profile" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires seccomp, so skip this test if seccomp is not enabled. enabled=$(is_seccomp_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -196,11 +171,6 @@ function teardown() { # pod -> NO # result: success, running unconfined @test "ctr seccomp profiles falls back to unconfined" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires seccomp, so skip this test if seccomp is not enabled. enabled=$(is_seccomp_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -237,11 +207,6 @@ function teardown() { # 1. test running with pod unconfined # test that we can run with a syscall which would be otherwise blocked @test "pod seccomp profiles unconfined" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires seccomp, so skip this test if seccomp is not enabled. enabled=$(is_seccomp_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -278,11 +243,6 @@ function teardown() { # 2. test running with pod runtime/default # test that we cannot run with a syscall blocked by the default seccomp profile @test "pod seccomp profiles runtime/default" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires seccomp, so skip this test if seccomp is not enabled. enabled=$(is_seccomp_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -319,11 +279,6 @@ function teardown() { # 3. test running with pod wrong profile name @test "pod seccomp profiles wrong profile name" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires seccomp, so skip this test if seccomp is not enabled. enabled=$(is_seccomp_enabled) if [[ "$enabled" -eq 0 ]]; then @@ -356,11 +311,6 @@ function teardown() { # TODO(runcom): need https://issues.k8s.io/36997 # 4. test running with pod localhost/profile_name @test "pod seccomp profiles localhost/profile_name" { - # this test requires docker, thus it can't yet be run in a container - if [ "$TRAVIS" = "true" ]; then # instead of $TRAVIS, add a function is_containerized to skip here - skip "cannot yet run this test in a container, use sudo make localintegration" - fi - # this test requires seccomp, so skip this test if seccomp is not enabled. enabled=$(is_seccomp_enabled) if [[ "$enabled" -eq 0 ]]; then