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

[WIP] Introduce --namespace test flag and randomize test object names #3313

Closed
wants to merge 4 commits into from

Conversation

mgencur
Copy link
Contributor

@mgencur mgencur commented Jun 11, 2020

This PR uses random names for test objects and makes it possible to use a common test namespace as opposed to a separate namespace for each test.

Fixes #2776

Proposed Changes

  • Reuse --namespace flag from knative.dev/pkg
  • Randomize test object names

Release Note


Docs

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 11, 2020
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/test-and-release Test infrastructure, tests or release labels Jun 11, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mgencur
To complete the pull request process, please assign chizhg
You can assign the PR to them by writing /assign @chizhg in a comment when ready.

The full list of commands accepted by this bot can be found 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

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)

@mgencur
Copy link
Contributor Author

mgencur commented Jun 11, 2020

/hold

I'd like to try running the test suite with the flag enabled.

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 11, 2020
@grantr
Copy link
Contributor

grantr commented Jun 11, 2020

/cc @lberk

@mgencur
Copy link
Contributor Author

mgencur commented Jun 11, 2020

Hmm. I suppose limiting the length of namespace will require at least sub tests to have unique resource names so that they don't clash if they share the same namespace that is named according to the top-level test . Let's see.
Right now there's only one test (TestDefaultBrokerWithManyTriggers ) where subtests would share same namespace.

@mgencur
Copy link
Contributor Author

mgencur commented Jun 11, 2020

Alright. Due to the length of some tests this is more complicated :-/ Right now, I'm not sure this is the right solution.

test/lib/test_runner.go Outdated Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 21, 2020
@matzew
Copy link
Member

matzew commented Jun 25, 2020

wanna move this forward?

@mgencur
Copy link
Contributor Author

mgencur commented Jun 25, 2020

I'm working on this.

@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 25, 2020
@mgencur mgencur changed the title Introduce --stablenamespaces test flag Introduce --namespace test flag and randomize test object names Jun 25, 2020
Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -name '*.pb.go' -prune -o -type f -name '*.go' -print)
goimports -w $(find -name '*.go' | grep -v vendor | grep -v third_party | grep -v .pb.go | grep -v wire_gen.go)

@mgencur mgencur changed the title Introduce --namespace test flag and randomize test object names [WIP] Introduce --namespace test flag and randomize test object names Jun 25, 2020
@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 25, 2020
@mgencur
Copy link
Contributor Author

mgencur commented Jun 25, 2020

Hey, this is a preview of the new impl which uses a common namespace for all tests. I've converted three top-level tests to this new approach and they pass when running in parallel.
Please review before I move forward and modify the rest of the test suite to this style. Thanks!

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -name '*.pb.go' -prune -o -type f -name '*.go' -print)
goimports -w $(find -name '*.go' | grep -v vendor | grep -v third_party | grep -v .pb.go | grep -v wire_gen.go)

@knative-test-reporter-robot

The following jobs failed:

Test name Triggers Retries
pull-knative-eventing-integration-tests 0/3

Failed non-flaky tests preventing automatic retry of pull-knative-eventing-integration-tests:

test/e2e.TestTriggerNoBroker
test/e2e.TestTriggerNoBroker/Channel-messaging.knative.dev/v1beta1
test/e2e.TestTriggerNoBroker/InMemoryChannel-messaging.knative.dev/v1beta1

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 28, 2020
@knative-prow-robot
Copy link
Contributor

@mgencur: PR needs rebase.

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.

Copy link
Contributor

@devguyio devguyio left a comment

Choose a reason for hiding this comment

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

left a nit comment, otherwise lgtm.

}

// ToString converts the test case to a string to create names for different objects (e.g., triggers, services, etc.).
func (tc eventTestCase) String() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems the comment on line 46 was forgotten to be updated?

@@ -245,7 +251,7 @@ func TestBrokerWithManyTriggers(t *testing.T, brokerCreator BrokerCreator, shoul
eventTrackers := make(map[string]*recordevents.EventInfoStore, len(test.eventFilters))
for _, event := range test.eventFilters {
// Create event recorder pod and service
subscriberName := "dumper-" + event.String()
subscriberName := event.Name()
Copy link
Member

@lberk lberk Jul 14, 2020

Choose a reason for hiding this comment

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

Why did we remove the "dumper-" prefix (and "trigger-" one below)? Those common prefixes tend to help me establish the mental models when trying to debug a new (to me) test.

ninjaedit: maybe we can do something similar to your sender change? testlib.NameForTest("dumper-", even.Name()) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed it because the names need to be created in advance, and if I then prefix it with "dumper-" it may exceed the 63 limit, plus I'm getting segmentation faults because eventTrackers then don't include the right matcher and it calls a function on nil object. Anyway, I'll see if we can improve it a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now I'm facing a problem with running tests in parallel. Some of them label namespaces with knative-eventing-injection": "enabled" and some of them don't want this. These tests can't run in parallel. Pretty complicated...

@mgencur
Copy link
Contributor Author

mgencur commented Jul 24, 2020

I'm putting this on hold becuase there are plans to start a new architecture for the whole test suite soon. It does not make sense to go ahead and invest time in the old infra.

@knative-prow-robot
Copy link
Contributor

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

Test name Commit Details Rerun command
pull-knative-eventing-integration-tests 108dfb3 link /test pull-knative-eventing-integration-tests
pull-knative-eventing-conformance-tests 108dfb3 link /test pull-knative-eventing-conformance-tests

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.

@lberk lberk mentioned this pull request Sep 1, 2020
@github-actions
Copy link

This Pull Request is stale because it has been open for 90 days with
no activity. It will automatically close after 30 more days of
inactivity. Reopen with /reopen. Mark as fresh by adding the
comment /remove-lifecycle stale.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 27, 2020
@github-actions github-actions bot closed this Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test-and-release Test infrastructure, tests or release cla: yes Indicates the PR's author has signed the CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow for tests to run in a pre-created NS
10 participants