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
NO-JIRA: [e2e test framework] Add a flag to add an annotation to HostedCluster #3854
NO-JIRA: [e2e test framework] Add a flag to add an annotation to HostedCluster #3854
Conversation
✅ Deploy Preview for hypershift-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
test/e2e/e2e_test.go
Outdated
@@ -115,6 +115,7 @@ func TestMain(m *testing.M) { | |||
flag.StringVar(&globalOpts.ManagementClusterNamespace, "e2e.management-cluster-namespace", "", "Namespace of the management cluster's HostedCluster (required to test request serving isolation)") | |||
flag.StringVar(&globalOpts.ManagementClusterName, "e2e.management-cluster-name", "", "Name of the management cluster's HostedCluster (required to test request serving isolation)") | |||
flag.BoolVar(&globalOpts.DisablePKIReconciliation, "e2e.disable-pki-reconciliation", false, "If set, TestUpgradeControlPlane will upgrade the control plane without reconciling the pki components") | |||
flag.StringVar(&globalOpts.configurableClusterOptions.Annotation, "e2e.annotation", "", "An annotation to apply to the HostedCluster (key=value)") |
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.
I'd suggest making the annotations repeatable. That way we can add more than one annotation at a time. That will probably help us out in the future.
you can achieve this using a custom var with the flags package. i tested this out. here's an example.
package main
import (
"flag"
"fmt"
"strings"
)
type stringMapVar map[string]string
func (s *stringMapVar) String() string {
if *s == nil {
return ""
}
return fmt.Sprintf("%v", *s)
}
func (s *stringMapVar) Set(value string) error {
split := strings.Split(value, "=")
if len(split) != 2 {
return fmt.Errorf("invalid argument: %s", value)
}
if *s == nil {
*s = stringMapVar(map[string]string{})
}
map[string]string(*s)[split[0]] = split[1]
return nil
}
var annotations stringMapVar
func main() {
flag.Var(&annotations, "annotations", "")
flag.Parse()
if annotations != nil {
fmt.Printf("%s\n", annotations.String())
}
}
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.
done, thanks.
e2e.annotations
can be specified multiple times and the annotations are aggregated.
Signed-off-by: Oren Cohen <ocohen@redhat.com>
082e2e0
to
9deac8b
Compare
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: davidvossel, orenc1 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test e2e-aws |
/retest |
@orenc1: This pull request explicitly references no jira issue. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
/retest |
@orenc1: all tests passed! Full PR test history. Your PR dashboard. 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. |
/cherry-pick release-4.15 |
@orenc1: #3854 failed to apply on top of branch "release-4.15":
In response to this:
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. |
…Cluster manual backport of openshift#3854 Signed-off-by: Oren Cohen <ocohen@redhat.com>
What this PR does / why we need it:
This addition will allow us to insert a custom annotation needed for the e2e test suite for the HostedCluster.
In particular, specify the management platform type in case of kubevirt external infra testing.
Which issue(s) this PR fixes (optional, use
fixes #<issue_number>(, fixes #<issue_number>, ...)
format, where issue_number might be a GitHub issue, or a Jira story:Fixes #
Checklist