-
Notifications
You must be signed in to change notification settings - Fork 13
OCPBUGS-66219: fix: extract k8s conformance tests for OCP 4.20+ #183
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
OCPBUGS-66219: fix: extract k8s conformance tests for OCP 4.20+ #183
Conversation
4b8e2df to
13ab6eb
Compare
This commit implements two critical fixes for OCP 4.20+ compatibility: 1. **Failure propagation mechanism** - Detects when blocker plugins fail and stops dependent plugins - Prevents wasted execution time on tests that can't succeed - Exception: artifacts collector (plugin 99) always runs - Uses plugin ID check for cleaner, more maintainable logic - Location: openshift-tests-plugin/pkg/plugin/plugin.go:716 2. **Kubernetes conformance test extraction support** - Consumes extracted test list from init container - Checks for /tmp/shared/k8s-conformance-tests.list - Falls back to default suite if extraction unavailable - Works with init container defined in opct repository - Location: openshift-tests-plugin/plugin/entrypoint-tests.sh:59-76 Failure propagation chain: - 05 (upgrade) → blocks → 10 (kube-conformance) - 10 (kube-conformance) → blocks → 20 (conformance-validated) - 20 (conformance-validated) → blocks → 80 (replay) - 80 (replay) → blocks → 99 (artifacts-collector) - Plugin 99 (artifacts collector) always runs regardless of failures Related: redhat-openshift-ecosystem/opct#183 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
3249015 to
d8d3428
Compare
Fixed linter issues found in CI checks: **YAML linting (data/templates/plugins/openshift-kube-conformance.yaml)**: - Fixed line-length error on line 55 (93 > 80 characters) - Split echo message across two lines for better readability **Go linting (pkg/client/client_test.go)**: - Fixed errcheck warnings by handling return values from os.Setenv/os.Unsetenv - Used blank identifier (_) to explicitly ignore errors in test setup/cleanup - These are intentional in test contexts where environment setup failures would be caught by subsequent test assertions Validation: - ✅ yamllint passes for openshift-kube-conformance.yaml - ✅ make test - all tests passing - ✅ make vet - no issues found - ✅ go test ./pkg/client - all client tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
PR validated by openshift/release#71865 (comment) |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jcpowermac The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…and failure propagation (#82) ## Summary This PR implements two critical fixes for OCP 4.20+ compatibility and improved CI efficiency: 1. Failure propagation mechanism to stop dependent plugins when prerequisites fail 2. Support for consuming extracted Kubernetes conformance tests from init container ## Changes ### 1. Failure Propagation (plugin.go) **Problem**: When a conformance plugin fails, subsequent dependent plugins continue running and waste execution time on tests that cannot succeed. **Solution**: Added failure detection in `RunDependencyWaiter()` that: - Checks if blocker plugin status is "failed" - Returns error to stop dependent plugin execution - Exception: Plugin 99 (artifacts-collector) always runs to collect logs **Code change** (`openshift-tests-plugin/pkg/plugin/plugin.go:714-719`): ```go // Check if the blocker plugin failed and propagate failure to dependent plugins // Exception: artifacts collector (99-openshift-artifacts-collector) should always run if pStatusBlocker.Status == "failed" && p.ID() != PluginId99 { log.Errorf("Blocker plugin[%s] failed. Propagating failure to dependent plugin[%s]", pluginBlocker, p.Name()) return fmt.Errorf("blocker plugin %s failed, stopping execution of dependent plugin %s", pluginBlocker, p.Name()) } ``` **Failure propagation chain**: - 05 (upgrade) → blocks → 10 (kube-conformance) - 10 (kube-conformance) → blocks → 20 (conformance-validated) - 20 (conformance-validated) → blocks → 80 (replay) - 80 (replay) → blocks → 99 (artifacts-collector) ### 2. Kubernetes Conformance Test Extraction (entrypoint-tests.sh) **Problem**: OCP 4.20+ removed the `kubernetes/conformance` suite from openshift-tests. **Solution**: Added logic to consume extracted test list from init container: - Checks for `/tmp/shared/k8s-conformance-tests.list` (created by init container in opct repo) - Uses extracted tests if available and non-empty - Falls back to default suite if extraction fails or file is missing **Code change** (`openshift-tests-plugin/plugin/entrypoint-tests.sh:59-76`): ```bash # Check if we have extracted k8s conformance tests from OTE K8S_CONFORMANCE_LIST="/tmp/shared/k8s-conformance-tests.list" if [[ "${PLUGIN_NAME:-}" == "openshift-kube-conformance" ]] && [[ -f "${K8S_CONFORMANCE_LIST}" ]]; then TEST_COUNT=$(wc -l < "${K8S_CONFORMANCE_LIST}") if [[ $TEST_COUNT -gt 0 ]]; then echo "Using extracted Kubernetes conformance tests from OTE (${TEST_COUNT} tests)" cp "${K8S_CONFORMANCE_LIST}" "${CTRL_SUITE_LIST}" echo "Tests extracted from k8s-tests-ext binary" > ${CTRL_SUITE_LIST}.log else # Fallback to default suite fi fi ``` ## Benefits 1. **Improved CI efficiency**: Stops wasted execution time on dependent tests 2. **Clearer failure signals**: Failed prerequisites immediately propagate 3. **OCP 4.20+ support**: Works with extracted conformance tests 4. **Backward compatible**: Falls back gracefully on older versions 5. **Cleaner code**: Uses plugin ID instead of name/alias checks ## Related PRs - OPCT PR: redhat-openshift-ecosystem/opct#183 - Adds init container to extract k8s conformance tests from OTE ## Testing Validated with CI rehearsal jobs on OCP 4.20+ clusters. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Added init container to dynamically extract Kubernetes conformance tests from the OTE k8s-tests-ext binary to support OCP 4.20+ where the kubernetes/conformance suite was removed from openshift-tests. Changes: - Added extract-k8s-conformance-tests init container - Extracts k8s-tests-ext.gz from hyperkube image - Filters conformance tests using jq or grep as fallback - Saves test list to /tmp/shared/k8s-conformance-tests.list - Tests container uses extracted list via entrypoint-tests.sh - Gracefully falls back to default suite if extraction fails This ensures the kubernetes/conformance suite continues to work on OCP 4.20+ clusters while maintaining backward compatibility with earlier versions. Related: redhat-openshift-ecosystem/provider-certification-plugins#82 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fixed linter issues found in CI checks: **YAML linting (data/templates/plugins/openshift-kube-conformance.yaml)**: - Fixed line-length error on line 55 (93 > 80 characters) - Split echo message across two lines for better readability **Go linting (pkg/client/client_test.go)**: - Fixed errcheck warnings by handling return values from os.Setenv/os.Unsetenv - Used blank identifier (_) to explicitly ignore errors in test setup/cleanup - These are intentional in test contexts where environment setup failures would be caught by subsequent test assertions Validation: - ✅ yamllint passes for openshift-kube-conformance.yaml - ✅ make test - all tests passing - ✅ make vet - no issues found - ✅ go test ./pkg/client - all client tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
866ad50 to
9259d89
Compare
|
New changes are detected. LGTM label has been removed. |
rebased after conflict, merging after approvals. |
2be4d9c
into
redhat-openshift-ecosystem:main
Summary
This PR addresses OCP 4.20+ compatibility issues where the
kubernetes/conformancesuite was removed from openshift-tests, requiring dynamic extraction from the k8s-tests-ext binary. Additionally, it refactors the client architecture to improve code organization and maintainability.Problem
Starting with OCP 4.20, the
kubernetes/conformancesuite is no longer available in openshift-tests. This causes the kube-conformance plugin to fail when trying to run conformance tests. Additionally, the client initialization code was scattered across multiple packages, making it harder to maintain and test.Solution
1. Dynamic Test Extraction (OCP 4.20+ Support)
Added an init container (
extract-k8s-conformance-tests) to the kube-conformance plugin that:/tmp/shared/k8s-conformance-tests.list2. Suite Name Enforcement by Cluster Version
Added logic to automatically detect cluster version and set the appropriate suite name:
kubernetes/conformance(default)kubernetes/conformance/parallel(new parallel suite)Implementation:
setSuiteName()function inpkg/run/run.gothat:suiteNameKubernetesConformanceConfigMap key accordinglyDEFAULT_SUITE_NAMEenvironment variable3. Client Architecture Refactoring
Consolidated client creation into a unified
Clientstruct:Before:
After:
Benefits:
Files Updated:
pkg/client/client.go- New unified Client structpkg/client/client_test.go- Comprehensive unit tests (24 test scenarios)pkg/run/run.go- Updated to use new client architecturepkg/run/validations.go- Updated function signaturespkg/status/status.go- Updated to use new clientpkg/destroy/destroy.go- Updated to use new clientpkg/cmd/adm/e2ed/taintNode.go- Updated to use new clientChanges
Core Implementation Files
data/templates/plugins/openshift-kube-conformance.yamlextract-k8s-conformance-testsinit container (73 insertions)jqwith grep fallback for compatibilityDEFAULT_SUITE_NAMEfrom ConfigMap for version-specific suite selectionpkg/run/run.gosetSuiteName()function to detect cluster version and set suite nameClientstructpkg/client/client.goClientstruct with KClient, SClient, and RestConfigCreateClients()withNewClient()for better encapsulationcreateRestConfig()private for better encapsulationpkg/client/client_test.go(NEW)Supporting Files
pkg/run/validations.gopkg/status/status.gopkg/destroy/destroy.goNewClient()instead ofCreateClients()pkg/cmd/adm/e2ed/taintNode.go.containerignore/.gitignoreBackward Compatibility
kubernetes/conformancesuitekubernetes/conformance/parallelsuite dynamicallyRelated PRs
getSuiteName()function to supportDEFAULT_SUITE_NAMEenvironment variableTesting
Validation Performed
make test(30 packages)make vetyamllintmake buildCI Validation
Migration Notes
For developers updating code that uses the client package:
Before:
After:
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]