Skip to content
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

Do not parse flags in InitializeEventingFlags #6966

Merged
merged 2 commits into from
May 24, 2023

Conversation

mgencur
Copy link
Contributor

@mgencur mgencur commented May 23, 2023

Provides better flexibility for reusing in downstream repositories. It is now possible to initialize flags from this repo and any additional flags from downstream repositories and then call flag.Parse explicitly to fill the flags. Then it's possible to run RunMainTest independently.

This is especially useful when we want to combine REKT tests with upgrade test suite.

Fixes #

Proposed Changes

  • Remove BrokerClass flag and make it a const, there's only one possible value anyway.
  • Pull flag.Parse() out of InitializeEventingFlags.
  • It is now possible to do something like this in downstream repos and combine tests with REKT framework:
func TestMain(m *testing.M) {
	// Initialize any Eventing flags here.
        eventingtest.InitializeEventingFlags()

	restConfig, err := pkgTest.Flags.ClientConfig.GetRESTConfig()
	if err != nil {
		log.Fatal("Error building client config: ", err)
	}
        
        // Initialize additional REKT flags.
        // This function calls `flag.Parse()` internally
	global = environment.NewStandardGlobalEnvironment(func(cfg environment.Configuration) environment.Configuration {
		cfg.Config = restConfig
		return cfg
	})

        // Run the test suite.
	eventingupgrade.RunMainTest(m)
}

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note


Docs

Provides better flexibility for reusing in downstream repositories.
It is now possible to initialize flags from this repo and any additional
flags from downstream repositories and then call flag.Parse explicitly
to fill the flags. Then it's possible to run RunMainTest independently.

This is especially useful when we want to combine REKT tests with
upgrade test suite.
@knative-prow knative-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/test-and-release Test infrastructure, tests or release labels May 23, 2023
@knative-prow knative-prow bot requested a review from evankanderson May 23, 2023 13:02
@knative-prow knative-prow bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 23, 2023
@knative-prow knative-prow bot requested a review from odacremolbap May 23, 2023 13:02
@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.19 ⚠️

Comparison is base (0a12a6c) 79.98% compared to head (ad5cd42) 79.80%.

❗ Current head ad5cd42 differs from pull request most recent head 866b40d. Consider uploading reports for the commit 866b40d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6966      +/-   ##
==========================================
- Coverage   79.98%   79.80%   -0.19%     
==========================================
  Files         237      244       +7     
  Lines       12373    12793     +420     
==========================================
+ Hits         9897    10209     +312     
- Misses       1984     2078      +94     
- Partials      492      506      +14     

see 33 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

The flag doesn't exist anymore
@mgencur mgencur changed the title [WIP] Do not parse flags in InitializeEventingFlags Do not parse flags in InitializeEventingFlags May 23, 2023
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 23, 2023
@knative-prow-robot
Copy link
Contributor

@mgencur: once the present PR merges, I will cherry-pick it on top of release-1.10 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.10

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.

@@ -43,17 +42,18 @@ const (
BrokerNameUsage = "When testing a pre-existing broker, specify the Broker name so the conformance tests " +
"won't create their own."
BrokerNamespaceUsage = "When testing a pre-existing broker, this variable specifies the namespace the broker can be found in."
BrokerClass = "MTChannelBasedBroker"
Copy link
Member

@pierDipi pierDipi May 24, 2023

Choose a reason for hiding this comment

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

Why not leaving BrokerClass configurable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the only possible value is MTChannelBasedBroker. See the line which I removed: https://github.com/knative/eventing/pull/6966/files#diff-1bee0234a4a7bc66483f6aaffb29c6b0d6fc372bde980d3023c564fb30219893L77

Not sure if we'll have more options in the future. I can return it back but it's just redundant code right now.

Copy link
Member

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label May 24, 2023
@knative-prow
Copy link

knative-prow bot commented May 24, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mgencur, pierDipi

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 24, 2023
@knative-prow knative-prow bot merged commit d4609a5 into knative:main May 24, 2023
31 of 35 checks passed
@knative-prow-robot
Copy link
Contributor

@mgencur: new pull request created: #6971

In response to this:

/cherry-pick release-1.10

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.

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. area/test-and-release Test infrastructure, tests or release lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants