-
Notifications
You must be signed in to change notification settings - Fork 84
UPSTREAM: <carry>: Skip few Mongo tests. #2009
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| package e2e_test | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "strings" | ||
|
|
||
| "github.com/onsi/ginkgo/v2" | ||
| ) | ||
|
|
||
| // TestSkipInfo contains information about why a test is skipped | ||
| type TestSkipInfo struct { | ||
| BugNumber string | ||
| Reason string | ||
| // Set to true if the skip can be overridden by environment variable | ||
| Overridable bool | ||
| } | ||
|
|
||
| // testSkipRegistry maps test names to skip information | ||
| // This is the central registry for all skipped tests | ||
| var testSkipRegistry = map[string]TestSkipInfo{ | ||
| // Mongo CSI and DATAMOVER tests - skipped due to known issues | ||
| "Mongo application CSI": { | ||
| BugNumber: "OADP-XXXX", | ||
| Reason: "CSI snapshots failing for Mongo workloads", | ||
| Overridable: true, | ||
| }, | ||
| "Mongo application DATAMOVER": { | ||
| BugNumber: "OADP-XXXX", | ||
| Reason: "DATAMOVER backup failing for Mongo workloads", | ||
| Overridable: true, | ||
| }, | ||
| "Mongo application BlockDevice DATAMOVER": { | ||
| BugNumber: "OADP-XXXX", | ||
| Reason: "Block device DATAMOVER failing for Mongo workloads", | ||
| Overridable: true, | ||
| }, | ||
| "Mongo application CSI via CLI": { | ||
| BugNumber: "OADP-XXXX", | ||
| Reason: "CSI snapshots failing for Mongo workloads via CLI", | ||
| Overridable: true, | ||
| }, | ||
| "Mongo application DATAMOVER via CLI": { | ||
| BugNumber: "OADP-XXXX", | ||
| Reason: "DATAMOVER backup failing for Mongo workloads via CLI", | ||
| Overridable: true, | ||
| }, | ||
| "Mongo application BlockDevice DATAMOVER via CLI": { | ||
| BugNumber: "OADP-XXXX", | ||
| Reason: "Block device DATAMOVER failing for Mongo workloads via CLI", | ||
| Overridable: true, | ||
| }, | ||
| } | ||
|
Comment on lines
+21
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace placeholder bug numbers with actual bug references. All entries in the skip registry use placeholder bug numbers "OADP-XXXX" instead of referencing actual bugs. This defeats the purpose of tracking known issues and makes it impossible to verify if tests should still be skipped or if bugs have been resolved. Update each entry with the actual bug number from your issue tracking system. For example: "Mongo application CSI": {
- BugNumber: "OADP-XXXX",
+ BugNumber: "OADP-1234",
Reason: "CSI snapshots failing for Mongo workloads",
Overridable: true,
},
🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mpryc You're right to question this. If you're planning to fill in the actual bug numbers before merging, or if you're still in the process of filing/identifying the specific issues, placeholder values are perfectly fine for now. The main value of actual bug numbers is being able to track when issues are resolved and tests can be re-enabled, but if that's something you're planning to add later or handle differently, that works too. I'll leave it to your judgment on what makes sense for this PR. |
||
|
|
||
| // shouldSkipTest checks if a test should be skipped based on the registry | ||
| // and environment variable settings | ||
| func shouldSkipTest(testName string) (bool, string) { | ||
| skipInfo, exists := testSkipRegistry[testName] | ||
| if !exists { | ||
| return false, "" | ||
| } | ||
|
|
||
| // Check if skips are disabled via environment variable | ||
| // Set OADP_SKIP_KNOWN_FAILURES=false to run all tests regardless of skip registry | ||
| if skipInfo.Overridable { | ||
| skipEnv := os.Getenv("OADP_SKIP_KNOWN_FAILURES") | ||
| if strings.ToLower(skipEnv) == "false" { | ||
| return false, "" | ||
| } | ||
| } | ||
|
|
||
| skipMessage := fmt.Sprintf("SKIPPED: %s - Bug: %s - Reason: %s", | ||
| testName, skipInfo.BugNumber, skipInfo.Reason) | ||
| return true, skipMessage | ||
| } | ||
|
|
||
| // SkipIfNeeded checks if the current test should be skipped and skips it if necessary | ||
| // This should be called at the beginning of each test that might be skipped | ||
| func SkipIfNeeded(testName string) { | ||
| if shouldSkip, message := shouldSkipTest(testName); shouldSkip { | ||
| ginkgo.Skip(message) | ||
| } | ||
| } | ||
|
|
||
| // GetSkippedTestsList returns a formatted list of all tests in the skip registry | ||
| // Useful for documentation and CI reporting | ||
| func GetSkippedTestsList() string { | ||
| if len(testSkipRegistry) == 0 { | ||
| return "No tests are currently skipped" | ||
| } | ||
|
|
||
| var sb strings.Builder | ||
| sb.WriteString("Currently skipped tests:\n") | ||
| for testName, skipInfo := range testSkipRegistry { | ||
| sb.WriteString(fmt.Sprintf(" - %s\n", testName)) | ||
| sb.WriteString(fmt.Sprintf(" Bug: %s\n", skipInfo.BugNumber)) | ||
| sb.WriteString(fmt.Sprintf(" Reason: %s\n", skipInfo.Reason)) | ||
| if skipInfo.Overridable { | ||
| sb.WriteString(" Override: Set OADP_SKIP_KNOWN_FAILURES=false to run this test\n") | ||
| } | ||
| } | ||
| return sb.String() | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Fix package name mismatch.
The package declaration
e2e_testconflicts with existing test files in the same directory that use packagee2e. This will cause a compilation failure.Apply this diff to fix the package name:
📝 Committable suggestion
🧰 Tools
🪛 golangci-lint (2.5.0)
[error] 1-1: : found packages e2e (backup_restore_cli_suite_test.go) and e2e_test (test_skip_config.go) in tests/e2e
(typecheck)
🤖 Prompt for AI Agents
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.
Not true, look at other files in this folder. They all are in the
package e2e_testThere 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.
🧩 Analysis chain
🏁 Script executed:
Length of output: 2029
@mpryc You're absolutely right, and I apologize for the incorrect suggestion. I've verified the package declarations in the
tests/e2e/directory, and all test suite files consistently usepackage e2e_test:backup_restore_cli_suite_test.go:package e2e_testtest_skip_config.go:package e2e_testbackup_restore_suite_test.go:package e2e_testpackage e2e_testThe golangci-lint error claiming that
backup_restore_cli_suite_test.gousespackage e2eappears to be stale or based on outdated information. The current code is actually correct and consistent. The linter error should resolve after a clean build or when the linter cache is refreshed.Your package declaration in
test_skip_config.gois correct as-is. No changes are needed.