ci-operator-checkconfig: Forbid some chars in multistage test name#5190
ci-operator-checkconfig: Forbid some chars in multistage test name#5190danilo-gemoli wants to merge 1 commit into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
📝 WalkthroughWalkthroughThis PR adds validation to reject multi-stage test names containing forbidden characters ( ChangesForbidden character validation for multi-stage test names
🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 12 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (12 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pkg/validation/test.go (1)
46-48: 💤 Low valueConsider adding a comment explaining why the character is forbidden.
The constant is clear, but a brief comment explaining the rationale (e.g., conflicts with step naming conventions, reserved for system use, etc.) would help future maintainers understand the constraint without needing to trace back to PR
#5188.📝 Suggested documentation
+// multiStageTestNameForbiddenChars contains characters that cannot appear in +// multi-stage test names because [brief reason - e.g., they conflict with step naming]. const ( testStageUnknown testStage = iota🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/validation/test.go` around lines 46 - 48, Add a brief inline comment above the constant multiStageTestNameForbiddenChars explaining why the character "." is forbidden (for example: it conflicts with step naming conventions, is reserved for system use, or causes parsing/namespace collisions) so future maintainers can understand the rationale without tracing PR `#5188`; locate the constant in pkg/validation/test.go and add one concise sentence referencing the specific reason (e.g., conflicts with step names or reserved delimiter).pkg/validation/test_test.go (1)
715-725: ⚡ Quick winExpand test coverage for the forbidden character validation.
The test correctly validates the new rule for
MultiStageTestConfiguration(steps), but is missing coverage for:
MultiStageTestConfigurationLiteral(literal_steps) - should also reject dots- Container tests with dots in names - should still be allowed
🧪 Suggested additional test cases
{ id: `test name contains forbidden chars with literal_steps`, tests: []api.TestStepConfiguration{ { As: "e2e-release-4.22", MultiStageTestConfigurationLiteral: &api.MultiStageTestConfigurationLiteral{ Test: []api.LiteralTestStep{{ As: "step", From: "base", Commands: "echo test", Resources: api.ResourceRequirements{Requests: api.ResourceList{"cpu": "1"}}, }}, }, }, }, expectedError: errors.New("tests[0].as: 'e2e-release-4.22' is not a valid name, the following chars '.' are forbidden"), }, { id: `container test name can contain forbidden chars`, tests: []api.TestStepConfiguration{ { As: "e2e-release-4.22", Commands: "commands", ContainerTestConfiguration: &api.ContainerTestConfiguration{From: "base"}, }, }, // No expected error - container tests are not restricted },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/validation/test_test.go` around lines 715 - 725, Add two test cases to the table in pkg/validation/test_test.go: one that exercises MultiStageTestConfigurationLiteral by creating a TestStepConfiguration with As: "e2e-release-4.22" and MultiStageTestConfigurationLiteral containing a LiteralTestStep (use api.LiteralTestStep, api.ResourceRequirements and api.ResourceList) and assert the same expectedError string about '.' being forbidden; and another that creates a TestStepConfiguration with As: "e2e-release-4.22" and ContainerTestConfiguration (api.ContainerTestConfiguration{From: "base"}) and assert that no error is returned (i.e., do not set expectedError) to verify container tests are allowed to contain dots. Ensure the new cases follow the existing table structure and use the same expectedError text as the existing MultiStageTestConfiguration case.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pkg/validation/test_test.go`:
- Around line 715-725: Add two test cases to the table in
pkg/validation/test_test.go: one that exercises
MultiStageTestConfigurationLiteral by creating a TestStepConfiguration with As:
"e2e-release-4.22" and MultiStageTestConfigurationLiteral containing a
LiteralTestStep (use api.LiteralTestStep, api.ResourceRequirements and
api.ResourceList) and assert the same expectedError string about '.' being
forbidden; and another that creates a TestStepConfiguration with As:
"e2e-release-4.22" and ContainerTestConfiguration
(api.ContainerTestConfiguration{From: "base"}) and assert that no error is
returned (i.e., do not set expectedError) to verify container tests are allowed
to contain dots. Ensure the new cases follow the existing table structure and
use the same expectedError text as the existing MultiStageTestConfiguration
case.
In `@pkg/validation/test.go`:
- Around line 46-48: Add a brief inline comment above the constant
multiStageTestNameForbiddenChars explaining why the character "." is forbidden
(for example: it conflicts with step naming conventions, is reserved for system
use, or causes parsing/namespace collisions) so future maintainers can
understand the rationale without tracing PR `#5188`; locate the constant in
pkg/validation/test.go and add one concise sentence referencing the specific
reason (e.g., conflicts with step names or reserved delimiter).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 6a398faf-056a-4b9e-8d8b-b0ed9bf9a55f
📒 Files selected for processing (2)
pkg/validation/test.gopkg/validation/test_test.go
|
/test e2e |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danilo-gemoli, deepsm007 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 |
|
Tests from second stage were triggered manually. Pipeline can be controlled only manually, until HEAD changes. Use command to trigger second stage. |
|
@danilo-gemoli: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
This is an alternative solution to #5188