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

Reusing testing code across repos #1522

Merged
merged 3 commits into from
Aug 7, 2023
Merged

Conversation

cniackz
Copy link
Contributor

@cniackz cniackz commented Mar 26, 2023

Objective

To reuse code across repositories.

Plan:

To use git submodules so that code in shared-functions/shared-code.sh will be used in other repos.

Unrelated:

  • Failure in Tenant Tests On Kind / test-policy-binding is not related to this changes.

Next Steps:

If this gets approved and merged, we can use sub-modules in Enterprise to re-use this function and then we can little by little re-use as much functions and code as possible since testing is being done the same way with Kind

@cniackz cniackz self-assigned this Mar 26, 2023
@cniackz cniackz changed the title Reusing code across repos [WIP] - Reusing code across repos Mar 26, 2023
@cniackz cniackz added the wip label Mar 26, 2023
@cniackz cniackz changed the title [WIP] - Reusing code across repos [WIP] - Reusing testing code across repos Mar 26, 2023
@cniackz cniackz changed the title [WIP] - Reusing testing code across repos Reusing testing code across repos Mar 27, 2023
@cniackz cniackz added enhancement New feature or request and removed wip labels Mar 27, 2023
Copy link
Member

@pjuarezd pjuarezd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase from master @cniackz, that will fix the failing test.

Please include the method wait_for_resource_field_selector in the shared-code.sh as well

operator/testing/common.sh

Lines 206 to 234 in 1f1d9d4

function wait_for_resource_field_selector() {
# example 1 job:
# namespace="minio-tenant-1"
# codition="condition=Complete"
# selector="metadata.name=setup-bucket"
# wait_for_resource_field_selector $namespace job $condition $selector
#
# example 2 tenant:
# wait_for_resource_field_selector $namespace job $condition $selector
# condition=jsonpath='{.status.currentState}'=Initialized
# selector="metadata.name=storage-policy-binding"
# wait_for_resource_field_selector $namespace tenant $condition $selector 900s
namespace=$1
resourcetype=$2
condition=$3
fieldselector=$4
if [ $# -ge 5 ]; then
timeout="$5"
else
timeout="600s"
fi
echo "Waiting for $resourcetype \"$fieldselector\" for \"$condition\" ($timeout timeout)"
kubectl wait -n "$namespace" "$resourcetype" \
--for=$condition \
--field-selector $fieldselector \
--timeout="$timeout"
}

@cniackz
Copy link
Contributor Author

cniackz commented Apr 2, 2023

@pjuarezd thank you for the code review, I have included the requested function already!. Please review again 👍

@pjuarezd pjuarezd merged commit 64f6d81 into minio:master Aug 7, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants