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

USHIFT-3271: Prevent pod name-collisions in storage tests #3516

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion test/resources/common.resource
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,25 @@ Resource ../resources/kubeconfig.resource
Setup Suite
[Documentation] Setup a namespace-less test suite by configuring Kubeconfig
Check Required Env Variables
Login MicroShift Host
Setup Kubeconfig

Setup Suite With Namespace
[Documentation] Setup a test suite by creating a unique namespace and configuring Kubeconfig
Check Required Env Variables
Login MicroShift Host
Setup Kubeconfig
${ns}= Create Unique Namespace
Set Suite Variable \${NAMESPACE} ${ns}

Create Unique Namespace
[Documentation] Creates a namespace with a unique suffix
${rand}= Generate Random String
${rand}= Convert To Lower Case ${rand}
${ns}= Catenate SEPARATOR=- test ${rand}
Set Suite Variable \${NAMESPACE} ${ns}

Create Namespace ${ns}
RETURN ${ns}

Teardown Suite
[Documentation] Teardown the namespace-less test suite by removing the Kubeconfig.
Expand Down
7 changes: 5 additions & 2 deletions test/suites/storage/pvc-resize.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Resource ../../resources/common.resource
Resource ../../resources/oc.resource
Resource ../../resources/ostree-health.resource

Suite Setup Setup Suite With Namespace
Suite Teardown Teardown Suite With Namespace
Suite Setup Setup Suite
Suite Teardown Teardown Suite


*** Variables ***
Expand All @@ -28,9 +28,12 @@ Increase Running Pod PV Size
*** Keywords ***
Test Case Setup
[Documentation] Prepare the cluster env and test pod workload.
${ns}= Create Unique Namespace
Set Test Variable \${NAMESPACE} ${ns}
Oc Create -f ${SOURCE_POD} -n ${NAMESPACE}
Named Pod Should Be Ready ${POD_NAME_STATIC}

Test Case Teardown
[Documentation] Clean up test suite resources
Oc Delete -f ${SOURCE_POD} -n ${NAMESPACE}
Remove Namespace ${NAMESPACE}
6 changes: 4 additions & 2 deletions test/suites/storage/reboot.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Resource ../../resources/common.resource
Resource ../../resources/oc.resource
Resource ../../resources/ostree-health.resource

Suite Setup Setup Suite With Namespace
Suite Setup Setup Suite

Test Tags restart slow

Expand All @@ -28,10 +28,12 @@ Rebooting Healthy System Should Keep Functional PVC
*** Keywords ***
Test Case Setup
[Documentation] Prepare the cluster env and test pod workload.
${ns}= Create Unique Namespace
Set Test Variable \${NAMESPACE} ${ns}
Oc Create -f ${SOURCE_POD} -n ${NAMESPACE}
Named Pod Should Be Ready ${POD_NAME_STATIC}

Test Case Teardown
[Documentation] Clean up test suite resources
Oc Delete -f ${SOURCE_POD} -n ${NAMESPACE}
Named Pod Should Be Deleted ${POD_NAME_STATIC} timeout=120s
Remove Namespace ${NAMESPACE}
7 changes: 5 additions & 2 deletions test/suites/storage/snapshot.robot
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Snapshotter Smoke Test
Test Suite Setup
[Documentation] Setup test namespace, patch the lvmd for thin-volume support, and restart microshift for
... it to take effect
Setup Suite With Namespace
Setup Suite
Create Thin Storage Pool
Save Lvmd Config
${config}= Extend Lvmd Config
Expand All @@ -58,10 +58,12 @@ Test Suite Teardown
Delete Thin Storage Pool
Restart Microshift
Restart Greenboot And Wait For Success
Teardown Suite With Namespace
Teardown Suite

Test Case Setup
[Documentation] Prepare the cluster-level APIs and a data-volume with some simple text
${ns}= Create Unique Namespace
Set Test Variable \${NAMESPACE} ${ns}
Oc Apply -k ${SOURCE_KUSTOMIZE} -n ${NAMESPACE}
Named Pod Should Be Ready ${POD_NAME_STATIC}
Write To Volume ${POD_NAME_STATIC} ${TEST_DATA}
Expand All @@ -78,6 +80,7 @@ Test Case Teardown
Oc Delete pvc snapshot-restore -n ${NAMESPACE}
Named PVC Should Be Deleted test-claim-thin
Named PVC Should Be Deleted snapshot-restore
Remove Namespace ${NAMESPACE}

Write To Volume
[Documentation] Write some simple text to the data volume
Expand Down