-
Notifications
You must be signed in to change notification settings - Fork 66
Migrating Ipfailover test cases to images repo #243
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
Draft
melvinjoseph86
wants to merge
1
commit into
openshift:master
Choose a base branch
from
melvinjoseph86:ipfailover_migration_e2e
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7,924,817
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ipfailover/keepalived/tests/bin/ipfailover-tests-ext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| BINARY := bin/ipfailover-tests-ext | ||
|
|
||
| .PHONY: build | ||
| build: | ||
| @echo "Building extension binary..." | ||
| @mkdir -p bin | ||
| GOTOOLCHAIN=auto GOSUMDB=sum.golang.org go build -o $(BINARY) ./cmd | ||
| @echo "✅ Binary built: $(BINARY)" | ||
|
|
||
| .PHONY: clean | ||
| clean: | ||
| @rm -f $(BINARY) | ||
|
|
||
| .PHONY: help | ||
| help: | ||
| @echo "Available targets:" | ||
| @echo " build - Build extension binary" | ||
| @echo " clean - Remove binaries" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # ipfailover OTE Test Extension | ||
|
|
||
| All 6 ipfailover tests have been successfully migrated from openshift-tests-private to the OTE (openshift-tests-extension) framework. | ||
|
|
||
| ## Test Suites | ||
|
|
||
| ### ipfailover/all | ||
| All 6 tests (must run with `--max-concurrency=1`) | ||
|
|
||
| ### ipfailover/conformance/serial | ||
| 4 serial tests (must run sequentially): | ||
| - 41025 - support to deploy ipfailover | ||
| - 41028 - ipfailover configuration can be customized by ENV | ||
| - 41029 - ipfailover can support up to 255 VIPs | ||
| - 49214 - Excluding existing VRRP cluster ID | ||
|
|
||
| ### ipfailover/disruptive | ||
| 2 disruptive tests: | ||
| - 41027 - pod and service automatically switched over | ||
| - 41030 - preemption strategy for keepalived ipfailover | ||
|
|
||
| ## How to Run | ||
|
|
||
| ```bash | ||
| export KUBECONFIG=/path/to/kubeconfig | ||
|
|
||
| # Build the binary | ||
| make build | ||
|
|
||
| # Run all tests | ||
| ./bin/ipfailover-tests-ext run-suite ipfailover/all --max-concurrency=1 | ||
|
|
||
| # Run specific suites | ||
| ./bin/ipfailover-tests-ext run-suite ipfailover/conformance/serial --max-concurrency=1 | ||
| ./bin/ipfailover-tests-ext run-suite ipfailover/disruptive --max-concurrency=1 | ||
| ``` | ||
|
|
||
| **Important**: Tests must run serially (`--max-concurrency=1`) because they use `hostNetwork: true` and will conflict if run in parallel. | ||
|
|
||
| ## Test Execution Time | ||
|
|
||
| - Single test: 1-5 minutes | ||
| - Serial suite: 10-15 minutes | ||
| - Disruptive suite: 7-10 minutes | ||
| - All tests: 15-20 minutes | ||
|
|
||
| ## Files | ||
|
|
||
| ``` | ||
| tests/ | ||
| ├── cmd/main.go # OTE entry point, suite definitions | ||
| ├── e2e/ | ||
| │ ├── ipfailover.go # 6 test implementations | ||
| │ ├── util.go # Helper functions | ||
| │ └── testdata/ | ||
| │ └── router/ # Test YAML fixtures (used directly, no bindata) | ||
| ├── Makefile # Simple build (no bindata generation) | ||
| ├── go.mod # Dependencies | ||
| └── README.md # This file | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "regexp" | ||
| "strings" | ||
|
|
||
| "github.com/spf13/cobra" | ||
| "k8s.io/component-base/logs" | ||
|
|
||
| "github.com/openshift-eng/openshift-tests-extension/pkg/cmd" | ||
| e "github.com/openshift-eng/openshift-tests-extension/pkg/extension" | ||
| et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests" | ||
| g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo" | ||
| "github.com/openshift/origin/test/extended/util" | ||
| framework "k8s.io/kubernetes/test/e2e/framework" | ||
|
|
||
| // Import test packages from this module | ||
| _ "github.com/openshift/ipfailover-tests-extension/e2e" | ||
| ) | ||
|
|
||
| func main() { | ||
| // Initialize test framework flags (required for kubeconfig, provider, etc.) | ||
| util.InitStandardFlags() | ||
| framework.AfterReadingAllFlags(&framework.TestContext) | ||
|
|
||
| logs.InitLogs() | ||
| defer logs.FlushLogs() | ||
|
|
||
| registry := e.NewRegistry() | ||
| ext := e.NewExtension("openshift", "payload", "ipfailover") | ||
|
|
||
| // Register test suites (parallel, serial, disruptive, all) | ||
| registerSuites(ext) | ||
|
|
||
| // Build test specs from Ginkgo | ||
| // Note: ModuleTestsOnly() is applied by default, which filters out /vendor/ and k8s.io/kubernetes tests | ||
| allSpecs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite() | ||
| if err != nil { | ||
| panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error())) | ||
| } | ||
|
|
||
| // Filter to only include tests from this module's e2e/ directory | ||
| // Excludes tests from /go/pkg/mod/ (module cache) and /vendor/ | ||
| componentSpecs := allSpecs.Select(func(spec *et.ExtensionTestSpec) bool { | ||
| for _, loc := range spec.CodeLocations { | ||
| // Include tests from local e2e/ directory (not from module cache or vendor) | ||
| if strings.Contains(loc, "/e2e/") && !strings.Contains(loc, "/go/pkg/mod/") && !strings.Contains(loc, "/vendor/") { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| }) | ||
|
|
||
| // Initialize test framework before all tests | ||
| // Note: In OTE, we don't need the OTP-specific InitTest() call | ||
| // The framework initialization is handled by the test execution itself | ||
|
|
||
| // Process all specs | ||
| componentSpecs.Walk(func(spec *et.ExtensionTestSpec) { | ||
| // Apply platform filters based on Platform: labels | ||
| for label := range spec.Labels { | ||
| if strings.HasPrefix(label, "Platform:") { | ||
| platformName := strings.TrimPrefix(label, "Platform:") | ||
| spec.Include(et.PlatformEquals(platformName)) | ||
| } | ||
| } | ||
|
|
||
| // Apply platform filters based on [platform:xxx] in test names | ||
| re := regexp.MustCompile(`\[platform:([a-z]+)\]`) | ||
| if match := re.FindStringSubmatch(spec.Name); match != nil { | ||
| platform := match[1] | ||
| spec.Include(et.PlatformEquals(platform)) | ||
| } | ||
|
|
||
| // Set lifecycle to Blocking (tests should fail the suite if they fail) | ||
| spec.Lifecycle = et.LifecycleBlocking | ||
| }) | ||
|
|
||
| // Add filtered component specs to extension | ||
| ext.AddSpecs(componentSpecs) | ||
|
|
||
| registry.Register(ext) | ||
|
|
||
| root := &cobra.Command{ | ||
| Long: "Ipfailover Tests", | ||
| } | ||
|
|
||
| root.AddCommand(cmd.DefaultExtensionCommands(registry)...) | ||
|
|
||
| if err := func() error { | ||
| return root.Execute() | ||
| }(); err != nil { | ||
| os.Exit(1) | ||
| } | ||
| } | ||
|
|
||
| // registerSuites registers test suites with proper categorization | ||
| func registerSuites(ext *e.Extension) { | ||
| suites := []e.Suite{ | ||
| { | ||
| Name: "ipfailover/conformance/serial", | ||
| Parents: []string{ | ||
| "openshift/conformance/serial", | ||
| }, | ||
| Description: "Serial conformance tests (must run sequentially)", | ||
| Qualifiers: []string{ | ||
| `name.contains("[Serial]") && !name.contains("[Disruptive]")`, | ||
| }, | ||
| }, | ||
| { | ||
| Name: "ipfailover/disruptive", | ||
| Parents: []string{"openshift/disruptive"}, | ||
| Description: "Disruptive tests (may affect cluster state)", | ||
| Qualifiers: []string{ | ||
| `name.contains("[Disruptive]")`, | ||
| }, | ||
| }, | ||
| { | ||
| Name: "ipfailover/all", | ||
| Description: "All ipfailover tests", | ||
| // No qualifiers means all tests from this extension will be included | ||
| }, | ||
| } | ||
|
|
||
| for _, suite := range suites { | ||
| ext.AddSuite(suite) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/images
Length of output: 972
🏁 Script executed:
Repository: openshift/images
Length of output: 6376
🏁 Script executed:
Repository: openshift/images
Length of output: 2173
Move
framework.AfterReadingAllFlagsafter flag parsing. Calling it beforeroot.Execute()leavesframework.TestContexton defaults, so kube/e2e flag overrides are ignored.🤖 Prompt for AI Agents