diff --git a/.cirrus.yml b/.cirrus.yml index d96dcd97a5..fc8a398452 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -919,32 +919,6 @@ rootless_system_test_task: always: *logs_artifacts -minikube_test_task: - name: *std_name_fmt - alias: minikube_test - # Docs: ./contrib/cirrus/CIModes.md (Cirrus Task contexts and runtime modes) - # only when: - main rules (see doc above); or - # - minikube test code is changed or one of the shared helper import files from the system test; or - # - actual source code changed - only_if: >- - $CIRRUS_PR == '' || - $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || - changesInclude('test/minikube/**', 'test/system/*.bash') || - (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) - # 2024-05-21: flaking almost constantly since March. - skip: $CI == $CI - depends_on: *build - gce_instance: *standardvm - env: - <<: *stdenvars - TEST_FLAVOR: minikube - PRIV_NAME: rootless - clone_script: *get_gosrc - setup_script: *setup - main_script: *main - always: *logs_artifacts - farm_test_task: name: *std_name_fmt alias: farm_test @@ -1100,7 +1074,6 @@ success_task: - remote_system_test - rootless_remote_system_test - rootless_system_test - - minikube_test - farm_test - buildah_bud_test - upgrade_test diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh index e24ef73761..cf37a6daed 100755 --- a/contrib/cirrus/runner.sh +++ b/contrib/cirrus/runner.sh @@ -97,12 +97,6 @@ function _run_endpoint() { showrun make endpoint } -function _run_minikube() { - _bail_if_test_can_be_skipped test/minikube - msg "Testing minikube." - showrun bats test/minikube |& logformatter -} - function _run_farm() { _bail_if_test_can_be_skipped test/farm test/system msg "Testing podman farm." diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh index f703ab32eb..640af943e7 100755 --- a/contrib/cirrus/setup_environment.sh +++ b/contrib/cirrus/setup_environment.sh @@ -384,14 +384,6 @@ case "$TEST_FLAVOR" in showrun make install PREFIX=/usr ETCDIR=/etc install_test_configs ;; - minikube) - showrun dnf install -y $PACKAGE_DOWNLOAD_DIR/minikube-latest* - remove_packaged_podman_files - showrun make install.tools - showrun make install PREFIX=/usr ETCDIR=/etc - showrun minikube config set driver podman - install_test_configs - ;; machine-linux) showrun dnf install -y podman-gvproxy* virtiofsd # Bootstrap this link if it isn't yet in the package; xref diff --git a/test/minikube/001-kube.bats b/test/minikube/001-kube.bats deleted file mode 100755 index 2f3ffeec8b..0000000000 --- a/test/minikube/001-kube.bats +++ /dev/null @@ -1,209 +0,0 @@ -#!/usr/bin/env bats -# -# Tests of podman kube commands with minikube -# - -load helpers.bash - -############################################################################### -# BEGIN tests - -@test "minikube - check cluster is up" { - run_minikube kubectl get nodes - assert "$output" =~ "Ready" - run_minikube kubectl get pods - assert "$output" == "No resources found in default namespace." -} - -@test "minikube - deploy generated container yaml to minikube" { - cname="test-ctr" - fname="/tmp/minikube_deploy_$(random_string 6).yaml" - run_podman container create --name $cname $IMAGE top - run_podman kube generate -f $fname $cname - - # deploy to the minikube cluster - project="ctr-ns" - run_minikube kubectl create namespace $project - run_minikube kubectl -- apply -f $fname - assert "$output" == "pod/$cname-pod created" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} - -@test "minikube - deploy generated pod yaml to minikube" { - pname="test-pod" - cname1="test-ctr1" - cname2="test-ctr2" - fname="/tmp/minikube_deploy_$(random_string 6).yaml" - - run_podman pod create --name $pname --publish 9999:8888 - run_podman container create --name $cname1 --pod $pname $IMAGE sleep 1000 - run_podman container create --name $cname2 --pod $pname $IMAGE sleep 2000 - run_podman kube generate -f $fname $pname - - # deploy to the minikube cluster - project="pod-ns" - run_minikube kubectl create namespace $project - run_minikube kubectl -- apply -f $fname - assert "$output" == "pod/$pname created" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} - -@test "minikube - apply podman ctr to cluster" { - cname="test-ctr-apply" - run_podman container create --name $cname $IMAGE top - - # deploy to minikube cluster with kube apply - project="ctr-apply" - run_minikube kubectl create namespace $project - run_podman kube apply --kubeconfig $KUBECONFIG --ns $project $cname - assert "$output" =~ "Successfully deployed workloads to cluster!" - run_minikube kubectl -- get pods --namespace $project - assert "$output" =~ "$cname-pod" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} - -@test "minikube - apply podman pod to cluster" { - pname="test-pod-apply" - run_podman pod create --name $pname - run_podman container create --pod $pname $IMAGE top - - # deploy to minikube cluster with kube apply - project="pod-apply" - run_minikube kubectl create namespace $project - run_podman kube apply --kubeconfig $KUBECONFIG --ns $project $pname - assert "$output" =~ "Successfully deployed workloads to cluster!" - run_minikube kubectl -- get pods --namespace $project - assert "$output" =~ "$pname" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} - -@test "minikube - deploy generated kube yaml with podman kube apply to cluster" { - pname="test-pod" - cname1="test-ctr1" - cname2="test-ctr2" - fname="/tmp/minikube_deploy_$(random_string 6).yaml" - - run_podman pod create --name $pname --publish 9999:8888 - run_podman container create --name $cname1 --pod $pname $IMAGE sleep 1000 - run_podman container create --name $cname2 --pod $pname $IMAGE sleep 2000 - run_podman kube generate -f $fname $pname - - # deploy to minikube cluster with kube apply - project="yaml-apply" - run_minikube kubectl create namespace $project - run_podman kube apply --kubeconfig $KUBECONFIG --ns $project -f $fname - assert "$output" =~ "Successfully deployed workloads to cluster!" - run_minikube kubectl -- get pods --namespace $project - assert "$output" =~ "$pname" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} - -@test "minikube - apply podman ctr with volume to cluster" { - cname="ctr-vol" - vname="myvol" - run_podman container create -v $vname:/myvol --name $cname $IMAGE top - - # deploy to minikube cluster with kube apply - project="ctr-vol-apply" - run_minikube kubectl create namespace $project - run_podman kube apply --kubeconfig $KUBECONFIG --ns $project $cname $vname - assert "$output" =~ "Successfully deployed workloads to cluster!" - run_minikube kubectl -- get pods --namespace $project - assert "$output" =~ "$cname-pod" - run_minikube kubectl -- get pvc --namespace $project - assert "$output" =~ "$vname" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} - -@test "minikube - apply podman ctr with service to cluster" { - cname="ctr-svc" - run_podman container create -p 3000:4000 --name $cname $IMAGE top - - # deploy to minikube cluster with kube apply - project="ctr-svc-apply" - run_minikube kubectl create namespace $project - run_podman kube apply --kubeconfig $KUBECONFIG -s --ns $project $cname - assert "$output" =~ "Successfully deployed workloads to cluster!" - run_minikube kubectl -- get pods --namespace $project - assert "$output" =~ "$cname-pod" - run_minikube kubectl -- get svc --namespace $project - assert "$output" =~ "$cname-pod" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} - -@test "minikube - deploy generated container yaml to minikube --type=deployment" { - cname="test-ctr" - fname="/tmp/minikube_deploy_$(random_string 6).yaml" - run_podman container create --name $cname $IMAGE top - run_podman kube generate --type deployment -f $fname $cname - - # deploy to the minikube cluster - project="dep-ctr-ns" - run_minikube kubectl create namespace $project - run_minikube kubectl -- apply -f $fname - assert "$output" == "deployment.apps/$cname-pod-deployment created" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} - -@test "minikube - deploy generated pod yaml to minikube --type=deployment" { - pname="test-pod" - cname1="test-ctr1" - cname2="test-ctr2" - fname="/tmp/minikube_deploy_$(random_string 6).yaml" - - run_podman pod create --name $pname --publish 9999:8888 - run_podman container create --name $cname1 --pod $pname $IMAGE sleep 1000 - run_podman container create --name $cname2 --pod $pname $IMAGE sleep 2000 - run_podman kube generate --type deployment -f $fname $pname - - # deploy to the minikube cluster - project="dep-pod-ns" - run_minikube kubectl create namespace $project - run_minikube kubectl -- apply -f $fname - assert "$output" == "deployment.apps/$pname-deployment created" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} - -@test "minikube - deploy generated container yaml to minikube --type=daemonset" { - cname="test-ctr" - fname="/tmp/minikube_deploy_$(random_string 6).yaml" - run_podman container create --name $cname $IMAGE top - run_podman kube generate --type daemonset -f $fname $cname - - # deploy to the minikube cluster - project="dep-ctr-ns" - run_minikube kubectl create namespace $project - run_minikube kubectl -- apply -f $fname - assert "$output" == "daemonset.apps/$cname-pod-daemonset created" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} - -@test "minikube - deploy generated pod yaml to minikube --type=daemonset" { - pname="test-pod" - cname1="test-ctr1" - cname2="test-ctr2" - fname="/tmp/minikube_deploy_$(random_string 6).yaml" - - run_podman pod create --name $pname --publish 9999:8888 - run_podman container create --name $cname1 --pod $pname $IMAGE sleep 1000 - run_podman container create --name $cname2 --pod $pname $IMAGE sleep 2000 - run_podman kube generate --type daemonset -f $fname $pname - - # deploy to the minikube cluster - project="dep-pod-ns" - run_minikube kubectl create namespace $project - run_minikube kubectl -- apply -f $fname - assert "$output" == "daemonset.apps/$pname-daemonset created" - wait_for_pods_to_start - run_minikube kubectl delete namespace $project -} diff --git a/test/minikube/helpers.bash b/test/minikube/helpers.bash deleted file mode 100644 index 24e394647c..0000000000 --- a/test/minikube/helpers.bash +++ /dev/null @@ -1,111 +0,0 @@ -# -*- bash -*- - -load ../system/helpers.bash - -KUBECONFIG="$HOME/.kube/config" - -################## -# run_minikube # Local helper, with instrumentation for debugging failures -################## -function run_minikube() { - # Number as first argument = expected exit code; default 0 - local expected_rc=0 - case "$1" in - [0-9]) expected_rc=$1; shift;; - [1-9][0-9]) expected_rc=$1; shift;; - [12][0-9][0-9]) expected_rc=$1; shift;; - '?') expected_rc= ; shift;; # ignore exit code - esac - - # stdout is only emitted upon error; this printf is to help in debugging - printf "\n%s %s %s %s\n" "$(timestamp)" "\$" "minikube" "$*" - run minikube "$@" - # without "quotes", multiple lines are glommed together into one - if [[ -n "$output" ]]; then - echo "$(timestamp) $output" - fi - if [[ "$status" -ne 0 ]]; then - echo -n "$(timestamp) [ rc=$status "; - if [[ -n "$expected_rc" ]]; then - if [[ "$status" -eq "$expected_rc" ]]; then - echo -n "(expected) "; - else - echo -n "(** EXPECTED $expected_rc **) "; - fi - fi - echo "]" - fi - - if [[ -n "$expected_rc" ]]; then - if [[ "$status" -ne "$expected_rc" ]]; then - # Further debugging - echo "\$ minikube logs" - run minikube logs - echo "$output" - - die "exit code is $status; expected $expected_rc" - fi - fi -} - - -function setup(){ - # only set up the minikube cluster before the first test - if [[ "$BATS_TEST_NUMBER" -eq 1 ]]; then - run_minikube start - wait_for_default_sa - fi - basic_setup -} - -function teardown(){ - # only delete the minikube cluster if we are done with the last test - # the $DEBUG_MINIKUBE env can be set to preserve the cluster to debug if needed - if [[ "$BATS_TEST_NUMBER" -eq ${#BATS_TEST_NAMES[@]} ]] && [[ "$DEBUG_MINIKUBE" == "" ]]; then - run_minikube delete - fi - - # Prevents nasty red warnings in log - run_podman rmi --ignore $(pause_image) - - basic_teardown -} - -function wait_for_default_sa(){ - count=0 - sa_ready=false - # timeout after 30 seconds - # if the default service account hasn't been created yet, there is something else wrong - while [[ $count -lt 30 ]] && [[ $sa_ready == false ]] - do - run_minikube kubectl get sa - if [[ "$output" != "No resources found in default namespace." ]]; then - sa_ready=true - fi - count=$((count + 1)) - sleep 1 - done - if [[ $sa_ready == false ]]; then - die "Timed out waiting for default service account to be created" - fi -} - -function wait_for_pods_to_start(){ - count=0 - running=false - # timeout after 30 seconds - # if the pod hasn't started running after 30 seconds, there is something else wrong - while [[ $count -lt 30 ]] && [[ $running == false ]] - do - run_minikube kubectl get pods - assert "$status" -eq 0 - if [[ "$output" =~ "Running" ]]; then - running=true - fi - count=$((count + 1)) - sleep 1 - done - if [[ $running == false ]]; then - die "Timed out waiting for pod to move to 'Running' state" - fi -}