Module tests.test_provisioner
Functions
def create_storage(api, sc_manifest, pvc_manifest)
-
Create a StorageClass and PersistentVolumeClaim for testing.
def test_provisioner_fs_format(client, core_api, storage_class, pvc, pod, inode_size, block_size)
-
Context: https://github.com/longhorn/longhorn/issues/4642 This is to test the FS format options are configured as mentioned in the storage class.
- Deploy a new storage class 'longhorn-provisioner' with mkfsParams param.
- Deploy a PVC and POD with the above storage class.
- A Longhorn volume should get created, verify the Inode size and block size. They should be same as the mkfsParams parameter.
def test_provisioner_generic_ephemeral()
-
Test that a Longhorn generic ephemeral volume can be created, mounted, unmounted, and deleted properly on the Kubernetes cluster.
- Create a StorageClass and Pod with a generic ephemeral volume spec: https://kubernetes.io/docs/concepts/storage/ephemeral-volumes
- Verify:
- The Pod is running.
- The volume parameters match the StorageClass parameters.
- The volume.status.kubernetesStatus.workloadStatus reflects the running Pod.
- Write data to the volume using the Pod, read it back, and verify it.
def test_provisioner_io(client, core_api, storage_class, pvc, pod)
-
Test that input and output on a StorageClass provisioned PersistentVolumeClaim works as expected.
Fixtures are torn down here in reverse order that they are specified as a parameter. Take caution when reordering test fixtures.
- Create a StorageClass, PVC and Pod.
- Wait for pod to be up.
- Write data to the pod
- Delete the original pod and create a new one using the same PVC
- Read the data from the new pod, verify the data.
def test_provisioner_mount(client, core_api, storage_class, pvc, pod)
-
Test that a StorageClass provisioned volume can be created, mounted, unmounted, and deleted properly on the Kubernetes cluster.
Fixtures are torn down here in reverse order that they are specified as a parameter. Take caution when reordering test fixtures.
- Create a StorageClass, PVC and Pod
- Verify the pod is up and volume parameters.
def test_provisioner_params(client, core_api, storage_class, pvc, pod)
-
Test that substituting different StorageClass parameters is reflected in the resulting PersistentVolumeClaim.
Fixtures are torn down here in reverse order that they are specified as a parameter. Take caution when reordering test fixtures.
- Create a StorageClass with replica 2 (instead of 3) etc.
- Create PVC and Pod using it.
- Verify the volume's parameter matches the Storage Class.
-
Test that a StorageClass can properly provision a volume with requested Tags.
Test prerequisite: - set Replica Node Level Soft Anti-Affinity enabled
- Use
node_default_tags
to add default tags to nodes. - Create a StorageClass with disk and node tag set.
- Create PVC and Pod.
- Verify the volume has the correct parameters and tags.
- Use