Skip to content

Commit 1bd11c7

Browse files
author
Dmitry Prytkov
committed
test(e2e): check that the tpm module is recognized in the os
Signed-off-by: Dmitry Prytkov <[email protected]>
1 parent b42fa77 commit 1bd11c7

17 files changed

+262
-1
lines changed

tests/e2e/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ type TestData struct {
161161
SSHUser string `yaml:"sshUser"`
162162
IPAM string `yaml:"ipam"`
163163
VMVpc string `yaml:"vmVpc"`
164+
VMTpm string `yaml:"vmTpm"`
164165
}
165166

166167
type StorageClass struct {

tests/e2e/config/reusable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
// ReusableEnv defines an environment variable used to reuse resources created previously.
2626
// By default, it retains all resources created during the e2e test after its completion (no cleanup by default in this mode).
27-
// Use the `WITH_POST_CLEANUP=yes` environment variable to clean up resources created or used during the test.
27+
// Use the `POST_CLEANUP=yes` environment variable to clean up resources created or used during the test.
2828
//
2929
// When a test starts, it will reuse existing virtual machines created earlier, if they exist.
3030
// If no virtual machines were found, they will be created.

tests/e2e/default_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ testData:
4141
sshKey: "/tmp/testdata/sshkeys/id_ed"
4242
sshUser: "cloud"
4343
vmVpc: "/tmp/testdata/vm-vpc"
44+
vmTpm: "/tmp/testdata/vm-tpm"
4445
logFilter:
4546
- "pattern to exclude"
4647
- "validation failed for data source objectref" # Err.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
namespace: test-vm-tpm
4+
namePrefix: tpm-
5+
resources:
6+
- ns.yaml
7+
- vi
8+
- vm
9+
configurations:
10+
- transformer.yaml
11+
labels:
12+
- includeSelectors: true
13+
pairs:
14+
id: pr-number-or-commit-hash
15+
testcase: vm-check-tpm

tests/e2e/testdata/vm-tpm/ns.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: default
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
namespace:
2+
- kind: ClusterVirtualImage
3+
path: spec/dataSource/objectRef/namespace
4+
nameReference:
5+
- kind: VirtualImage
6+
version: v1alpha2 # optional
7+
fieldSpecs:
8+
- path: spec/dataSource/objectRef/name
9+
kind: ClusterVirtualImage
10+
- path: spec/dataSource/objectRef/name
11+
kind: VirtualImage
12+
- path: spec/dataSource/objectRef/name
13+
kind: VirtualDisk
14+
- path: spec/blockDeviceRefs/name
15+
kind: VirtualMachine
16+
- kind: ClusterVirtualImage
17+
version: v1alpha2 # optional
18+
fieldSpecs:
19+
- path: spec/dataSource/objectRef/name
20+
kind: ClusterVirtualImage
21+
- path: spec/dataSource/objectRef/name
22+
kind: VirtualImage
23+
- path: spec/dataSource/objectRef/name
24+
kind: VirtualDisk
25+
- path: spec/blockDeviceRefs/name
26+
kind: VirtualMachine
27+
- kind: VirtualDisk
28+
version: v1alpha2 # optional
29+
fieldSpecs:
30+
- path: spec/blockDeviceRefs/name
31+
kind: VirtualMachine
32+
- path: spec/blockDeviceRef/name
33+
kind: VirtualMachineBlockDeviceAttachment
34+
- kind: Secret
35+
fieldSpecs:
36+
- path: spec/provisioning/userDataRef/name
37+
kind: VirtualMachine
38+
- kind: VirtualMachineIPAddress
39+
version: v1alpha2
40+
fieldSpecs:
41+
- path: spec/virtualMachineIPAddressName
42+
kind: VirtualMachine
43+
- kind: VirtualMachine
44+
version: v1alpha2
45+
fieldSpecs:
46+
- path: spec/virtualMachineName
47+
kind: VirtualMachineBlockDeviceAttachment
48+
- kind: VirtualMachineClass
49+
version: v1alpha2
50+
fieldSpecs:
51+
- path: spec/virtualMachineClassName
52+
kind: VirtualMachine
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- vi-debian-http.yaml
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
apiVersion: virtualization.deckhouse.io/v1alpha2
3+
kind: VirtualImage
4+
metadata:
5+
name: vi-debian-http
6+
spec:
7+
storage: ContainerRegistry
8+
dataSource:
9+
type: HTTP
10+
http:
11+
url: https://89d64382-20df-4581-8cc7-80df331f67fa.selstorage.ru/debian/debian-12-generic-amd64-20250814-2204.qcow2
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#cloud-config
2+
ssh_pwauth: True
3+
users:
4+
- name: cloud
5+
passwd: "$6$rounds=4096$saltsalt$fPmUsbjAuA7mnQNTajQM6ClhesyG0.yyQhvahas02ejfMAq1ykBo1RquzS0R6GgdIDlvS.kbUwDablGZKZcTP/"
6+
shell: /bin/bash
7+
sudo: ALL=(ALL) NOPASSWD:ALL
8+
lock_passwd: False
9+
ssh_authorized_keys:
10+
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFxcXHmwaGnJ8scJaEN5RzklBPZpVSic4GdaAsKjQoeA [email protected]
11+
packages:
12+
- qemu-guest-agent
13+
- tpm2-tools
14+
runcmd:
15+
- systemctl enable qemu-guest-agent --now
16+
- chown -R cloud:cloud /home/cloud
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ./vmclass-discovery.yaml
5+
- ./vd-root.yaml
6+
- ./vm.yaml
7+
generatorOptions:
8+
disableNameSuffixHash: true
9+
secretGenerator:
10+
- name: cloud-init
11+
files:
12+
- userData=./cfg/cloud-config.yaml
13+
type: provisioning.virtualization.deckhouse.io/cloud-init

0 commit comments

Comments
 (0)