-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(api): add e2e virtual disk snapshots test case
Signed-off-by: Roman Sysoev <[email protected]>
- Loading branch information
Roman Sysoev
committed
Dec 9, 2024
1 parent
fb2423c
commit 0d4e80b
Showing
27 changed files
with
916 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: testcases | ||
namePrefix: commit- | ||
resources: | ||
- ns.yaml | ||
- vd | ||
- vi | ||
- vm | ||
configurations: | ||
- transformer.yaml | ||
labels: | ||
- includeSelectors: true | ||
pairs: | ||
id: commit | ||
testcase: vd-snapshots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: default |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
namespace: | ||
- kind: ClusterVirtualImage | ||
path: spec/dataSource/objectRef/namespace | ||
nameReference: | ||
- kind: VirtualImage | ||
version: v1alpha2 # optional | ||
fieldSpecs: | ||
- path: spec/dataSource/objectRef/name | ||
kind: ClusterVirtualImage | ||
- path: spec/dataSource/objectRef/name | ||
kind: VirtualImage | ||
- path: spec/dataSource/objectRef/name | ||
kind: VirtualDisk | ||
- path: spec/blockDeviceRefs/name | ||
kind: VirtualMachine | ||
- kind: ClusterVirtualImage | ||
version: v1alpha2 # optional | ||
fieldSpecs: | ||
- path: spec/dataSource/objectRef/name | ||
kind: ClusterVirtualImage | ||
- path: spec/dataSource/objectRef/name | ||
kind: VirtualImage | ||
- path: spec/dataSource/objectRef/name | ||
kind: VirtualDisk | ||
- path: spec/blockDeviceRefs/name | ||
kind: VirtualMachine | ||
- kind: VirtualDisk | ||
version: v1alpha2 # optional | ||
fieldSpecs: | ||
- path: spec/blockDeviceRefs/name | ||
kind: VirtualMachine | ||
- path: spec/blockDeviceRef/name | ||
kind: VirtualMachineBlockDeviceAttachment | ||
- kind: Secret | ||
fieldSpecs: | ||
- path: spec/provisioning/userDataRef/name | ||
kind: VirtualMachine | ||
- kind: VirtualMachineIPAddress | ||
version: v1alpha2 | ||
fieldSpecs: | ||
- path: spec/virtualMachineIPAddressName | ||
kind: VirtualMachine | ||
- kind: VirtualMachine | ||
version: v1alpha2 | ||
fieldSpecs: | ||
- path: spec/virtualMachineName | ||
kind: VirtualMachineBlockDeviceAttachment | ||
- kind: VirtualMachineClass | ||
version: v1alpha2 | ||
fieldSpecs: | ||
- path: spec/virtualMachineClassName | ||
kind: VirtualMachine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- vd-alpine-http.yaml | ||
labels: | ||
- includeSelectors: true | ||
pairs: | ||
hasNoConsumer: "vd-snapshots" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
apiVersion: virtualization.deckhouse.io/v1alpha2 | ||
kind: VirtualDisk | ||
metadata: | ||
name: vd-alpine-http | ||
spec: | ||
dataSource: | ||
type: HTTP | ||
http: | ||
url: https://0e773854-6b4e-4e76-a65b-d9d81675451a.selstorage.ru/alpine/alpine-v3-20.qcow2 | ||
persistentVolumeClaim: | ||
size: 260Mi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- vi-alpine-http.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
apiVersion: virtualization.deckhouse.io/v1alpha2 | ||
kind: VirtualImage | ||
metadata: | ||
name: vi-alpine-http | ||
spec: | ||
storage: ContainerRegistry | ||
dataSource: | ||
type: HTTP | ||
http: | ||
url: https://0e773854-6b4e-4e76-a65b-d9d81675451a.selstorage.ru/alpine/alpine-v3-20.qcow2 |
51 changes: 51 additions & 0 deletions
51
tests/e2e/testdata/vd-snapshots/vm/base/cfg/cloudinit.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#cloud-config | ||
users: | ||
- name: cloud | ||
# passwd: cloud | ||
passwd: $6$rounds=4096$vln/.aPHBOI7BMYR$bBMkqQvuGs5Gyd/1H5DP4m9HjQSy.kgrxpaGEHwkX7KEFV8BS.HZWPitAtZ2Vd8ZqIZRqmlykRCagTgPejt1i. | ||
shell: /bin/bash | ||
sudo: ALL=(ALL) NOPASSWD:ALL | ||
chpasswd: { expire: False } | ||
lock_passwd: false | ||
ssh_authorized_keys: | ||
# testcases | ||
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFxcXHmwaGnJ8scJaEN5RzklBPZpVSic4GdaAsKjQoeA [email protected] | ||
write_files: | ||
- path: /etc/init.d/ping-service | ||
permissions: "0755" | ||
content: | | ||
#!/sbin/openrc-run | ||
command="/usr/bin/ping-service.sh" | ||
pidfile="/var/run/${RC_SVCNAME}.pid" | ||
depend() { | ||
need localmount | ||
after bootmisc | ||
} | ||
start() { | ||
ebegin "Starting ${RC_SVCNAME}" | ||
start-stop-daemon --start --background --exec $command --pidfile $pidfile -- $command_args | ||
eend $? | ||
} | ||
stop() { | ||
ebegin "Stopping ${RC_SVCNAME}" | ||
start-stop-daemon --stop --exec $command --pidfile $pidfile | ||
eend $? | ||
} | ||
- path: /usr/bin/ping-service.sh | ||
permissions: "0755" | ||
content: | | ||
#!/bin/bash | ||
while true; do | ||
ping -W1 -D 1.1.1.1 >> /tmp/ping.log | ||
done | ||
final_message: "\U0001F525\U0001F525\U0001F525 The system is finally up, after $UPTIME seconds \U0001F525\U0001F525\U0001F525" | ||
runcmd: | ||
- "echo \"\U0001F7E1 Starting runcmd at $(date +%H:%M:%S)\"" | ||
- rc-update add ping-service default | ||
- rc-service ping-service start | ||
- "echo \"\U0001F7E1 Finished runcmd at $(date +%H:%M:%S)\"" |
14 changes: 14 additions & 0 deletions
14
tests/e2e/testdata/vd-snapshots/vm/base/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ./vm.yaml | ||
- ./vd-root.yaml | ||
configurations: | ||
- transformer.yaml | ||
generatorOptions: | ||
disableNameSuffixHash: true | ||
secretGenerator: | ||
- files: | ||
- userData=cfg/cloudinit.yaml | ||
name: cloud-init | ||
type: provisioning.virtualization.deckhouse.io/cloud-init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# https://github.com/kubernetes-sigs/kustomize/blob/master/examples/transformerconfigs/README.md#transformer-configurations | ||
|
||
namespace: | ||
- kind: ClusterVirtualImage | ||
path: spec/dataSource/objectRef/namespace | ||
nameReference: | ||
- kind: VirtualImage | ||
version: v1alpha2 # optional | ||
fieldSpecs: | ||
- path: spec/dataSource/objectRef/name | ||
kind: ClusterVirtualImage | ||
- path: spec/dataSource/objectRef/name | ||
kind: VirtualImage | ||
- path: spec/dataSource/objectRef/name | ||
kind: VirtualDisk | ||
- path: spec/blockDeviceRefs/name | ||
kind: VirtualMachine | ||
- kind: ClusterVirtualImage | ||
version: v1alpha2 # optional | ||
fieldSpecs: | ||
- path: spec/dataSource/objectRef/name | ||
kind: ClusterVirtualImage | ||
- path: spec/dataSource/objectRef/name | ||
kind: VirtualImage | ||
- path: spec/dataSource/objectRef/name | ||
kind: VirtualDisk | ||
- path: spec/blockDeviceRefs/name | ||
kind: VirtualMachine | ||
- kind: VirtualDisk | ||
version: v1alpha2 # optional | ||
fieldSpecs: | ||
- path: spec/blockDeviceRefs/name | ||
kind: VirtualMachine | ||
- path: spec/blockDeviceRef/name | ||
kind: VirtualMachineBlockDeviceAttachment | ||
- kind: Secret | ||
fieldSpecs: | ||
- path: spec/provisioning/userDataRef/name | ||
kind: VirtualMachine | ||
- kind: VirtualMachineIPAddress | ||
version: v1alpha2 | ||
fieldSpecs: | ||
- path: spec/virtualMachineIPAddressName | ||
kind: VirtualMachine | ||
- kind: VirtualMachine | ||
version: v1alpha2 | ||
fieldSpecs: | ||
- path: spec/virtualMachineName | ||
kind: VirtualMachineBlockDeviceAttachment | ||
- kind: VirtualMachineClass | ||
version: v1alpha2 | ||
fieldSpecs: | ||
- path: spec/virtualMachineClassName | ||
kind: VirtualMachine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: virtualization.deckhouse.io/v1alpha2 | ||
kind: VirtualDisk | ||
metadata: | ||
name: vd-root | ||
spec: | ||
persistentVolumeClaim: | ||
size: 512Mi | ||
dataSource: | ||
type: ObjectRef | ||
objectRef: | ||
kind: VirtualImage | ||
name: vi-alpine-http |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: virtualization.deckhouse.io/v1alpha2 | ||
kind: VirtualMachine | ||
metadata: | ||
name: vm | ||
spec: | ||
virtualMachineClassName: generic | ||
cpu: | ||
cores: 1 | ||
coreFraction: 5% | ||
memory: | ||
size: 256Mi | ||
disruptions: | ||
restartApprovalMode: Manual | ||
provisioning: | ||
type: UserDataRef | ||
userDataRef: | ||
kind: Secret | ||
name: cloud-init | ||
blockDeviceRefs: | ||
- kind: VirtualDisk | ||
name: vd-root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- overlays/automatic | ||
- overlays/automatic-with-hotplug |
Oops, something went wrong.