Skip to content

Commit

Permalink
test/e2e: new container_runtime property for libvirt
Browse files Browse the repository at this point in the history
Commit a0247ae introduced a new parameter (CONTAINER_RUNTIME) for docker
provider, allowing users to specify the container runtime used. Some tests will
take decisions based on that property, for example, whether nydus snapshotter
messages should be inspected or not. Likewise, this added the handler for that
property for libvirt, so allowing to test with cri-o too.

Fixes confidential-containers#1981
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
  • Loading branch information
wainersm committed Nov 27, 2024
1 parent a9f7e19 commit 9763770
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/cloud-api-adaptor/test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Use the properties on the table below for Libvirt:
|Property|Description|Default|
|---|---|---|
|container_runtime|Test cluster configured container runtime. Either **containerd** or **crio** |containerd|
|libvirt_network|Libvirt Network|"default"|
|libvirt_storage|Libvirt storage pool|"default"|
|libvirt_vol_name|Volume name|"podvm-base.qcow2"|
Expand Down
45 changes: 24 additions & 21 deletions src/cloud-api-adaptor/test/provisioner/libvirt/provision_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ const AlternateVolumeName = "another-podvm-base.qcow2"

// LibvirtProvisioner implements the CloudProvisioner interface for Libvirt.
type LibvirtProvisioner struct {
conn *libvirt.Connect // Libvirt connection
network string // Network name
ssh_key_file string // SSH key file used to connect to Libvirt
storage string // Storage pool name
uri string // Libvirt URI
wd string // libvirt's directory path on this repository
volumeName string // Podvm volume name
clusterName string // Cluster name
conn *libvirt.Connect // Libvirt connection
containerRuntime string // Name of the container runtime
network string // Network name
ssh_key_file string // SSH key file used to connect to Libvirt
storage string // Storage pool name
uri string // Libvirt URI
wd string // libvirt's directory path on this repository
volumeName string // Podvm volume name
clusterName string // Cluster name
}

// LibvirtInstallOverlay implements the InstallOverlay interface
Expand Down Expand Up @@ -84,14 +85,15 @@ func NewLibvirtProvisioner(properties map[string]string) (pv.CloudProvisioner, e

// TODO: Check network and storage are not nil?
return &LibvirtProvisioner{
conn: conn,
network: network,
ssh_key_file: ssh_key_file,
storage: storage,
uri: uri,
wd: wd,
volumeName: vol_name,
clusterName: clusterName,
conn: conn,
containerRuntime: properties["container_runtime"],
network: network,
ssh_key_file: ssh_key_file,
storage: storage,
uri: uri,
wd: wd,
volumeName: vol_name,
clusterName: clusterName,
}, nil
}

Expand Down Expand Up @@ -196,11 +198,12 @@ func (l *LibvirtProvisioner) DeleteVPC(ctx context.Context, cfg *envconf.Config)

func (l *LibvirtProvisioner) GetProperties(ctx context.Context, cfg *envconf.Config) map[string]string {
return map[string]string{
"network": l.network,
"podvm_volume": l.volumeName,
"ssh_key_file": l.ssh_key_file,
"storage": l.storage,
"uri": l.uri,
"CONTAINER_RUNTIME": l.containerRuntime,
"network": l.network,
"podvm_volume": l.volumeName,
"ssh_key_file": l.ssh_key_file,
"storage": l.storage,
"uri": l.uri,
}
}

Expand Down

0 comments on commit 9763770

Please sign in to comment.