Skip to content

Conversation

@andfasano
Copy link
Contributor

This PR defines a new validation rule urlexist applied to the BootstrapOSImage and ClusterOSImage fields of baremetal.Platform structure, to ensure that the specified URL exists (without downloading the content).
The PR also contains the smallest refactoring step to allows a coherent validation approach for the mentioned fields.

Finally, the PR contains a proposal to improve the readability (and reduce the duplication and the chance of errors) of the related test code using the fluent builder pattern.

@andfasano
Copy link
Contributor Author

/assign @stbenjam

@stbenjam
Copy link
Member

/test e2e-metal-ipi

Copy link
Contributor

Choose a reason for hiding this comment

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

this process is fine, but validations in the other parts of the codebase solve this using modifiers like

installConfig: func() *types.InstallConfig {
c := validInstallConfig()
c.Publish = types.InternalPublishingStrategy
c.Platform.AWS.Subnets = []string{
"valid-private-subnet-a",
"valid-private-subnet-b",
"valid-private-subnet-c",
}
return c
}(),

I'm fine with all of these, but since these builders are not generated, we will end up adding functions for each new field, and most of the times the modifications to the valid examples happens in batches (multiple fields together)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Potentially the builder could be generated but I wanted to keep it simple, since function for a new field is added only once and very quickly, and after that can be reused by many developers when writing tests.
About batch modifications, not sure If I understood correctly: fluent builders allows modifying multiple fields together through the usage of method chaining (see for example https://github.com/andfasano/installer/blob/ab40687d1715529356df8c22d2b8b0abd3504db0/pkg/types/baremetal/validation/platform_test.go#L54)

@stbenjam
Copy link
Member

/test e2e-metal-ipi

1 similar comment
@stbenjam
Copy link
Member

/test e2e-metal-ipi

@andfasano andfasano force-pushed the validate-osimages-exist branch from ab40687 to 92a07c2 Compare March 31, 2020 08:41
@andfasano
Copy link
Contributor Author

/test e2e-metal-ipi

1 similar comment
@andfasano
Copy link
Contributor Author

/test e2e-metal-ipi

…ied to BootstrapOSImage and ClusterOSImage fields

added new validation rule to wrap existing url sanity checks on BootstrapOSImage and ClusterOSImage fields
@andfasano andfasano force-pushed the validate-osimages-exist branch from 92a07c2 to ccaf134 Compare March 31, 2020 16:49
@stbenjam
Copy link
Member

/test e2e-metal-ipi

@stbenjam
Copy link
Member

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 31, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: stbenjam

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 31, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

5 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 31, 2020

@andfasano: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-aws-scaleup-rhel7 ccaf134 link /test e2e-aws-scaleup-rhel7
ci/prow/e2e-openstack ccaf134 link /test e2e-openstack
ci/prow/e2e-metal-ipi ccaf134 link /test e2e-metal-ipi
ci/prow/e2e-libvirt ccaf134 link /test e2e-libvirt

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions 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/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 0a2f889 into openshift:master Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants