Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(e2e): label and annotation #7

Merged
merged 12 commits into from
Mar 20, 2024
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ __pycache__/
tmp/*

# Kubernetes
.kube
.kube

# direnv
.envrc
43 changes: 40 additions & 3 deletions tests/e2e/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ tasks:
virtctl:
vars:
VERSION: "v1.0.0"
CMD_PATH: "/usr/local/bin/virtctl"
cmds:
- |
URL="https://github.com/kubevirt/kubevirt/releases/download/{{ .VERSION }}/virtctl-{{ .VERSION }}-linux-amd64"
virtctl &>/dev/null || ( sudo curl -L $URL -o {{ .CMD_PATH }} && sudo chmod +x {{ .CMD_PATH }} )
case {{OS}} in
darwin*) CMD_PATH="/opt/homebrew/bin/virtctl" ;;
linux*) CMD_PATH="/usr/local/bin/virtctl" ;;
*) echo "unknown: {{OS}}"; exit 1 ;;
esac

URL="https://github.com/kubevirt/kubevirt/releases/download/{{ .VERSION }}/virtctl-{{ .VERSION }}-{{OS}}-{{ARCH}}"
test -f $CMD_PATH || ( sudo curl -L $URL -o $CMD_PATH && sudo chmod +x $CMD_PATH )
ginkgo:
vars:
VERSION: "2.13.2"
Expand All @@ -28,3 +33,35 @@ tasks:
cmds:
- ginkgo

run_local:
desc: "Run localy e2e tests"
deps:
- virtctl
- ginkgo
cmds:
- |
export KUBECONFIG={{.KUBECONFIG}}
export E2E_CLUSTERTRANSPORT_KUBECONFIG={{.E2E_CLUSTERTRANSPORT_KUBECONFIG}}
ginkgo
vars:
KUBECONFIG: '{{default "$HOME/.kube/config" .KUBECONFIG}}'
E2E_CLUSTERTRANSPORT_KUBECONFIG: '{{default "$HOME/.kube/config" .E2E_CLUSTERTRANSPORT_KUBECONFIG}}'

run_one:
desc: "Run one test or group"
deps:
- virtctl
- ginkgo
cmds:
- |
{{if .TEST }}
export KUBECONFIG={{.KUBECONFIG}}
export E2E_CLUSTERTRANSPORT_KUBECONFIG={{.E2E_CLUSTERTRANSPORT_KUBECONFIG}}
ginkgo --focus "{{ .TEST }}" -v
{{else}}
echo "Specify test to run"
echo 'Example: TEST="Label and Annotation" task run_one'
universal-itengineer marked this conversation as resolved.
Show resolved Hide resolved
{{end}}
vars:
KUBECONFIG: '{{default "$HOME/.kube/config" .KUBECONFIG}}'
E2E_CLUSTERTRANSPORT_KUBECONFIG: '{{default "$HOME/.kube/config" .E2E_CLUSTERTRANSPORT_KUBECONFIG}}'
15 changes: 8 additions & 7 deletions tests/e2e/kubectl/resource.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package kubectl

const (
ResourceNode Resource = "node"
ResourceNamespace Resource = "namespace"
ResourcePod Resource = "pod"
ResourceKubevirtVM Resource = "virtualmachines.x.virtualization.deckhouse.io"
ResourceVM Resource = "virtualmachine.virtualization.deckhouse.io"
ResourceVMIPClaim Resource = "virtualmachineipaddressclaims.virtualization.deckhouse.io"
ResourceVMIPLeas Resource = "virtualmachineipaddressleases.virtualization.deckhouse.io"
ResourceNode Resource = "node"
ResourceNamespace Resource = "namespace"
ResourcePod Resource = "pod"
ResourceKubevirtVM Resource = "virtualmachines.x.virtualization.deckhouse.io"
ResourceKubevirtVMI Resource = "virtualmachineinstances.x.virtualization.deckhouse.io"
ResourceVM Resource = "virtualmachine.virtualization.deckhouse.io"
ResourceVMIPClaim Resource = "virtualmachineipaddressclaims.virtualization.deckhouse.io"
ResourceVMIPLeas Resource = "virtualmachineipaddressleases.virtualization.deckhouse.io"
)
2 changes: 1 addition & 1 deletion tests/e2e/testdata/vm/boot/vm_cvmi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
runPolicy: AlwaysOn
osType: Generic
bootloader: BIOS
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/testdata/vm/boot/vm_vmd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
runPolicy: AlwaysOn
osType: Generic
bootloader: BIOS
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/testdata/vm/boot/vm_vmi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
runPolicy: AlwaysOn
osType: Generic
bootloader: BIOS
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/testdata/vm/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ spec:
type: "HTTP"
http:
insecureSkipVerify: true
url: "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"
url: "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
osType: Generic
bootloader: BIOS
cpu:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
osType: Generic
bootloader: BIOS
cpu:
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/testdata/vm/resources/vm_100.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
runPolicy: AlwaysOn
osType: Generic
bootloader: BIOS
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/testdata/vm/resources/vm_25.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
runPolicy: AlwaysOn
osType: Generic
bootloader: BIOS
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/testdata/vm/resources/vm_50.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
runPolicy: AlwaysOn
osType: Generic
bootloader: BIOS
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/testdata/vm/vm_graceperiod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
runPolicy: AlwaysOn
osType: Generic
bootloader: BIOS
Expand Down
19 changes: 19 additions & 0 deletions tests/e2e/testdata/vm/vm_label_annotation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: virtualization.deckhouse.io/v1alpha2
kind: VirtualMachine
metadata:
name: test-vm-label
namespace: test-d8-virtualization
spec:
disruptions:
restartApprovalMode: Automatic
runPolicy: AlwaysOn
osType: Generic
bootloader: BIOS
cpu:
cores: 1
memory:
size: 1Gi
blockDevices:
- type: VirtualMachineImage
virtualMachineImage:
name: test-vm-image
2 changes: 1 addition & 1 deletion tests/e2e/testdata/vm/vm_priorityclassname.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
runPolicy: AlwaysOn
osType: Generic
bootloader: BIOS
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/testdata/vm/vm_runpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: test-d8-virtualization
spec:
disruptions:
approvalMode: Automatic
restartApprovalMode: Automatic
runPolicy: AlwaysOn
osType: Generic
bootloader: BIOS
Expand Down
Loading
Loading