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

internal/scorecard/alpha: add parallelism support #3434

Merged
merged 2 commits into from
Jul 16, 2020

Conversation

joelanford
Copy link
Member

Description of the change:
Re-opening of #3420

Add support for stages and parallelism in scorecard

Motivation for the change:
Give users more flexbility in scheduling their tests and having them complete faster when they can be run in parallel.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

Copy link
Contributor

@jmccormick2001 jmccormick2001 left a comment

Choose a reason for hiding this comment

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

looks good to me, tested out with both parallel and non-parallel

Entrypoint: test.Entrypoint,
Labels: test.Labels,
}
output.Items = append(output.Items, item)
Copy link
Contributor

@camilamacedo86 camilamacedo86 Jul 15, 2020

Choose a reason for hiding this comment

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

usually nor happy with for inside to another for, however, I think it will not have too many items so 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

That's the only way this works 😄

This isn't an O(n^2) problem like it seems like you're referring to. Stages are just groups of tests. This function is (generally) O(number of tests) regardless of whether stages are introduced or not.

case <-ctx.Done():
return nil, ctx.Err()
default:
return r.TestStatus, r.Error
Copy link
Contributor

Choose a reason for hiding this comment

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

should we not keep the default?

Copy link
Member Author

@joelanford joelanford Jul 16, 2020

Choose a reason for hiding this comment

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

No because default in a select statement is used when none of the channels have available items. If we left default in, it would "win" and return immediately when what we really want is to wait for the timer or the context to expire.

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Image: test.Image,
Entrypoint: test.Entrypoint,
Labels: test.Labels,
for _, stage := range o.Config.Stages {
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to have duplicate tests across stages? I suspect this wouldn't be common if so.

Copy link
Member Author

Choose a reason for hiding this comment

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

As far as I know, there is nothing that would prevent it. Scorecard would happily run it twice and report the results twice. It would probably also handle duplicate tests in a single stage the same way.

Copy link
Member

Choose a reason for hiding this comment

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

Running duplicates is obviously fine. Test names listed may be duplicates though, which looks a little weird.

@@ -53,6 +54,7 @@ type PodTestRunner struct {
}

type FakeTestRunner struct {
Copy link
Member

Choose a reason for hiding this comment

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

For a follow-up: move this to run_test.go.

Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

A bunch of nits, otherwise

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 16, 2020
@joelanford joelanford merged commit 4b00053 into operator-framework:master Jul 16, 2020
@joelanford joelanford deleted the scorecard-parallel branch July 16, 2020 03:36
@joelanford joelanford mentioned this pull request Jul 16, 2020
92 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants