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

integration: refactor and split scheduler tests #109834

Merged
merged 10 commits into from May 6, 2022

Conversation

aojea
Copy link
Member

@aojea aojea commented May 5, 2022

/kind cleanup
/kind failing-test
Fixes #109783

NONE

The scheduler jobs on integration are close to the timeout of 10m (default in golang) , causing that sometimes the test panic and fails because of the timeout.

Splitting the tests in subdirectories, will run the subtests independently, with a 10m timeout per subtest

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 5, 2022
@k8s-ci-robot
Copy link
Contributor

@aojea: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 5, 2022
@aojea
Copy link
Member Author

aojea commented May 5, 2022

/assign @wojtek-t @alculquicondor

This will stop the bleeding, sig-scheduling can work independently on improving the tests after this if they want, but we should be less impacted by the global timeout, waiting for the results to confirm though ... 👀

test/integration/scheduler/plugin/plugin_test.go Outdated Show resolved Hide resolved
pod, err := createPausePod(testCtx.ClientSet,
initPausePod(&pausePodConfig{Name: "test-pod", Namespace: testCtx.NS.Name}))
pod, err := testutils.CreatePausePod(testCtx.ClientSet,
testutils.InitPausePod(&testutils.PausePodConfig{Name: "test-pod", Namespace: testCtx.NS.Name}))
Copy link
Member

Choose a reason for hiding this comment

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

Also maybe those function's aren't super controversial, but I would actually move them not to testutils, but rather to test/integration/scheduler/utils

Copy link
Member

Choose a reason for hiding this comment

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

+1
I just said the same before I saw your comment 😅

Copy link
Member Author

@aojea aojea May 6, 2022

Choose a reason for hiding this comment

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

it seems that the integrations/util is mainly by scheduler folks already

https://github.com/kubernetes/kubernetes/pull/109834/files#r866610966

Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

There are a lot of failures... I couldn't find any obvious mistakes.

But one of the failures is a timeout, even after the split? That sounds crazy.

test/integration/scheduler/predicates/predicates_test.go Outdated Show resolved Hide resolved
test/integration/scheduler/plugin/main_test.go Outdated Show resolved Hide resolved
test/integration/scheduler/priorities/priorities_test.go Outdated Show resolved Hide resolved

// InitTest initializes a test environment and creates API server and scheduler with default
// configuration.
func InitTest(t *testing.T, nsPrefix string, opts ...scheduler.Option) *TestContext {
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps InitTestScheduler?

Copy link
Member Author

@aojea aojea May 6, 2022

Choose a reason for hiding this comment

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

heh, already exists 😄
more reason to merge this to avoid drifting

test/integration/scheduler/extender/extender_test.go Outdated Show resolved Hide resolved
test/integration/util/util.go Show resolved Hide resolved

// InitDisruptionController initializes and runs a Disruption Controller to properly
// update PodDisuptionBudget objects.
func InitDisruptionController(t *testing.T, testCtx *TestContext) *disruption.DisruptionController {
Copy link
Member

Choose a reason for hiding this comment

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

These are a lot of function that are now under the ownership of sig-testing. Are you comfortable with that?

Maybe we can have a test/integration/scheduler/util package?

Copy link
Member Author

Choose a reason for hiding this comment

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

scheduler are the main users of the library already

grep -r "k8s.io/kubernetes/test/integration/util" test/integration/
test/integration/ipamperf/cloud.go:     "k8s.io/kubernetes/test/integration/util"
test/integration/ipamperf/ipam_test.go: "k8s.io/kubernetes/test/integration/util"
test/integration/scheduler/preemption_test.go:  testutils "k8s.io/kubernetes/test/integration/util"
test/integration/scheduler/priorities_test.go:  testutils "k8s.io/kubernetes/test/integration/util"
test/integration/scheduler/queue_test.go:       testutils "k8s.io/kubernetes/test/integration/util"
test/integration/scheduler/scheduler_test.go:   testutils "k8s.io/kubernetes/test/integration/util"
test/integration/scheduler/taint_test.go:       testutils "k8s.io/kubernetes/test/integration/util"
test/integration/scheduler/extender_test.go:    testutils "k8s.io/kubernetes/test/integration/util"
test/integration/scheduler/framework_test.go:   testutils "k8s.io/kubernetes/test/integration/util"
test/integration/scheduler/predicates_test.go:  testutils "k8s.io/kubernetes/test/integration/util"
test/integration/scheduler/util/util.go:        testutils "k8s.io/kubernetes/test/integration/util"
test/integration/scheduler_perf/util.go:        "k8s.io/kubernetes/test/integration/util"
test/integration/node/lifecycle_test.go:        testutils "k8s.io/kubernetes/test/integration/util"

and there are already scheduler only things like

// InitTestScheduler initializes a test environment and creates a scheduler with default
// configuration.
func InitTestScheduler(
t *testing.T,
testCtx *TestContext,
) *TestContext {
// Pod preemption is enabled by default scheduler configuration.
return InitTestSchedulerWithOptions(t, testCtx)
}
// InitTestSchedulerWithOptions initializes a test environment and creates a scheduler with default
// configuration and other options.
func InitTestSchedulerWithOptions(

I think that is simpler to have only one util package, I don't think that we suffers of bottlenecks on reviews and approvals in the integration framework, so if you don't mind I prefer to have only one package

@aojea
Copy link
Member Author

aojea commented May 5, 2022

the failures may be related to something wrong I did, I will redo it tomorrow following your comments

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 5, 2022
@aojea aojea force-pushed the split_scheduling_integration branch from 86ff0a2 to 277bcdb Compare May 6, 2022 09:25
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 6, 2022
@aojea aojea force-pushed the split_scheduling_integration branch from 277bcdb to 9dbe4c8 Compare May 6, 2022 09:27
@wojtek-t
Copy link
Member

wojtek-t commented May 6, 2022

There is a bunch of cleanup I would like to see in those utility functions, but that's not the request for this PR anyway...

/lgtm
/approve

Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2022
@aojea
Copy link
Member Author

aojea commented May 6, 2022

this reduces the times significatively

grep testsuite junit_20220506-095056.xml  | grep scheduler
        <testsuite tests="9" failures="0" time="68.750000" name="k8s.io/kubernetes/test/integration/scheduler" timestamp="">
        <testsuite tests="1" failures="0" time="5.900000" name="k8s.io/kubernetes/test/integration/scheduler/extender" timestamp="">
        <testsuite tests="37" failures="0" time="242.950000" name="k8s.io/kubernetes/test/integration/scheduler/filters" timestamp="">
        <testsuite tests="70" failures="0" time="304.949000" name="k8s.io/kubernetes/test/integration/scheduler/plugins" timestamp="">
        <testsuite tests="34" failures="0" time="225.040000" name="k8s.io/kubernetes/test/integration/scheduler/preemption" timestamp="">
        <testsuite tests="13" failures="0" time="73.020000" name="k8s.io/kubernetes/test/integration/scheduler/scoring" timestamp="">
        <testsuite tests="9" failures="0" time="36.479000" name="k8s.io/kubernetes/test/integration/scheduler/taint" timestamp="">
        <testsuite tests="0" failures="0" time="0.000000" name="k8s.io/kubernetes/test/integration/scheduler_perf" timestamp="">

I have lint errors because of unused variables :/

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2022
@aojea
Copy link
Member Author

aojea commented May 6, 2022

k8s.io/kubernetes/vendor/k8s.io/apiserver/pkg/server/filters: TestTimeoutWithLogging expand_less 0s
{Failed === RUN TestTimeoutWithLogging
timeout_test.go:358: got res.StatusCode 200; expected 503
--- FAIL: TestTimeoutWithLogging (0.01s)

/test pull-kubernetes-unit

@aojea
Copy link
Member Author

aojea commented May 6, 2022

Kubernetes e2e suite: [sig-api-machinery] ResourceQuota should create a ResourceQuota and capture the life of a service. [Conformance] expand_more

k8s.io/kubernetes/test/integration/daemonset: TestDSCUpdatesPodLabelAfterDedupCurHistories expand_more

timeout error unrelated to this Pr

/retest

@wojtek-t
Copy link
Member

wojtek-t commented May 6, 2022

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea, wojtek-t

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

@alculquicondor
Copy link
Member

Thanks! I'll take some days to clean up the mess.

@alculquicondor
Copy link
Member

We wouldn't cherry-pick this, would we?

k8s-ci-robot added a commit that referenced this pull request Dec 21, 2022
…4-upstream-release-1.24

Automated cherry pick of #109834: integration: refactor and split scheduler tests
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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky scheduler integration tests
4 participants