Skip to content

Commit

Permalink
[release-v0.6] Test and env updates (#220)
Browse files Browse the repository at this point in the history
* Add PartnerComp label

This label can be used to run tests with focus
on tests we consider neccessary to test partner
compatibility with kubevirt.
To run the tests:
make TEST_ARGS="--test-args=-ginkgo.label-filter=PartnerComp" test-functional

Signed-off-by: Shelly Kagan <skagan@redhat.com>

* Adjust tests to have configurable storageclass yamls

This change allows the user to set env variable
KVP_STORAGE_CLASS with the desired storage class
one wants the tests applying yamls to run with.
Adjust some tests to pass when using wffc SC

Signed-off-by: Shelly Kagan <skagan@redhat.com>

* Fix racy test

The test wants to catch the dv in state importing
but if the import is fast we can miss it.
Insted we can check that a file that existed
no longer exists after the backup.

Signed-off-by: Shelly Kagan <skagan@redhat.com>

* Ignore velero files in gitignore, delete existing

Signed-off-by: Shelly Kagan <skagan@redhat.com>

* Update kubevirtci due to a bug in last version

Signed-off-by: Shelly Kagan <skagan@redhat.com>

---------

Signed-off-by: Shelly Kagan <skagan@redhat.com>
Co-authored-by: Shelly Kagan <skagan@redhat.com>
  • Loading branch information
kubevirt-bot and ShellyKa13 authored Feb 13, 2024
1 parent dba1cf1 commit a32c37a
Show file tree
Hide file tree
Showing 30 changed files with 104 additions and 789 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
_output
kubevirt-velero-plugin
velero*

.go
.idea

_ci-configs
_ci-configs
20 changes: 19 additions & 1 deletion cluster-up/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
# How to use cluster-up
# cluster-up

## Prerequisites: podman or docker

cluster-up requires that either podman or docker be installed on the host.

If podman is being used, it is also necessary to enable podman socket with:

```
sudo systemctl enable podman.socket
sudo systemctl start podman.socket
```

for more information see:

https://github.com/kubevirt/kubevirtci/blob/main/PODMAN.md


## How to use cluster-up

This directory provides a wrapper around gocli. It can be vendored into other
git repos and integrated to provide in the kubevirt well-known cluster commands
Expand Down
File renamed without changes.
45 changes: 0 additions & 45 deletions cluster-up/cluster/kind-1.23/README.md

This file was deleted.

51 changes: 0 additions & 51 deletions cluster-up/cluster/kind-1.23/provider.sh

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

DEFAULT_CLUSTER_NAME="kind-1.27"
DEFAULT_CLUSTER_NAME="kind-1.28"
DEFAULT_HOST_PORT=5000
ALTERNATE_HOST_PORT=5001
export CLUSTER_NAME=${CLUSTER_NAME:-$DEFAULT_CLUSTER_NAME}
Expand All @@ -14,8 +14,8 @@ else
fi

function set_kind_params() {
export KIND_VERSION="${KIND_VERSION:-0.19.0}"
export KIND_NODE_IMAGE="${KIND_NODE_IMAGE:-kindest/node:v1.27.1@sha256:b7d12ed662b873bd8510879c1846e87c7e676a79fefc93e17b2a52989d3ff42b}"
export KIND_VERSION="${KIND_VERSION:-0.20.0}"
export KIND_NODE_IMAGE="${KIND_NODE_IMAGE:-kindest/node:v1.28.0@sha256:b7a4cad12c197af3ba43202d3efe03246b3f0793f162afb40a33c923952d5b31}"
export KUBECTL_PATH="${KUBECTL_PATH:-/usr/bin/kubectl}"
}

Expand Down
15 changes: 14 additions & 1 deletion cluster-up/cluster/kind/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ function detect_cri() {

export CRI_BIN=${CRI_BIN:-$(detect_cri)}
CONFIG_WORKER_CPU_MANAGER=${CONFIG_WORKER_CPU_MANAGER:-false}
# only setup ipFamily when the environmental variable is not empty
# avaliable value: ipv4, ipv6, dual
IPFAMILY=${IPFAMILY}

# check CPU arch
PLATFORM=$(uname -m)
Expand Down Expand Up @@ -286,10 +289,20 @@ EOF
fi
}

function _setup_ipfamily() {
if [ $IPFAMILY != "" ]; then
cat <<EOF >> ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
networking:
ipFamily: $IPFAMILY
EOF
echo "KIND cluster ip family has been set to $IPFAMILY"
fi
}

function _prepare_kind_config() {
_add_workers
_add_kubeadm_config_patches

_setup_ipfamily
echo "Final KIND config:"
cat ${KUBEVIRTCI_CONFIG_PATH}/$KUBEVIRT_PROVIDER/kind.yaml
}
Expand Down
98 changes: 0 additions & 98 deletions cluster-up/cluster/local/README.md

This file was deleted.

56 changes: 0 additions & 56 deletions cluster-up/cluster/local/provider.sh

This file was deleted.

4 changes: 2 additions & 2 deletions cluster-up/hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi


KUBEVIRTCI_CLUSTER_PATH=${KUBEVIRTCI_CLUSTER_PATH:-${KUBEVIRTCI_PATH}/cluster}
KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-k8s-1.25}
KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-k8s-1.27}
KUBEVIRT_NUM_NODES=${KUBEVIRT_NUM_NODES:-1}
KUBEVIRT_MEMORY_SIZE=${KUBEVIRT_MEMORY_SIZE:-5120M}
KUBEVIRT_NUM_SECONDARY_NICS=${KUBEVIRT_NUM_SECONDARY_NICS:-0}
Expand Down Expand Up @@ -48,4 +48,4 @@ provider_prefix=${JOB_NAME:-${KUBEVIRT_PROVIDER}}${EXECUTOR_NUMBER}
job_prefix=${JOB_NAME:-kubevirt}${EXECUTOR_NUMBER}

mkdir -p $KUBEVIRTCI_CONFIG_PATH/$KUBEVIRT_PROVIDER
KUBEVIRTCI_TAG=2309040711-7a80619
KUBEVIRTCI_TAG=2309141019-029e67a
2 changes: 1 addition & 1 deletion tests/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func getStorageClassFromEnv() string {
return ""
}

fmt.Fprintf(os.Stderr, "StorageClass Name [%s]\n", storageClass)
fmt.Fprintf(ginkgo.GinkgoWriter, "StorageClass Name [%s]\n", storageClass)
return storageClass
}

Expand Down
17 changes: 17 additions & 0 deletions tests/framework/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,20 @@ func (f *Framework) CreateKubectlCommand(args ...string) *exec.Cmd {

return cmd
}

// RunKubectlCreateYamlCommand replaces storageclassname placeholder with configured tests storageClass
// in a given yaml, creates it and returns err
func (f *Framework) RunKubectlCreateYamlCommand(yamlPath string) error {
kubeconfig := f.KubeConfig
path := f.KubectlPath
storageClass := f.StorageClass

cmdString := fmt.Sprintf("cat %s | sed 's/{{KVP_STORAGE_CLASS}}/%s/g' | %s create -n %s -f -", yamlPath, storageClass, path, f.Namespace.Name)
cmd := exec.Command("bash", "-c", cmdString)
kubeconfEnv := fmt.Sprintf("KUBECONFIG=%s", kubeconfig)
cmd.Env = append(os.Environ(), kubeconfEnv)
outBytes, err := cmd.CombinedOutput()
fmt.Fprintf(GinkgoWriter, "INFO: Output from kubectl: %s\n", string(outBytes))

return err
}
Loading

0 comments on commit a32c37a

Please sign in to comment.