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

Add Unit Tests that verify stats reporting in autoscaler #6912

Merged
merged 1 commit into from
Feb 21, 2020

Conversation

MIBc
Copy link
Contributor

@MIBc MIBc commented Feb 20, 2020

Fixes #6772

@knative-prow-robot knative-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 20, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Feb 20, 2020
@knative-prow-robot knative-prow-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 20, 2020
@knative-prow-robot
Copy link
Contributor

Hi @MIBc. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@MIBc
Copy link
Contributor Author

MIBc commented Feb 20, 2020

/assign @vagababov

@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 20, 2020
Copy link
Contributor

@vagababov vagababov left a comment

Choose a reason for hiding this comment

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

Thanks. This looks reasonable.
Can you also check that PanicM is set and unset.

@@ -65,6 +66,46 @@ func expectedEBC(totCap, targetBC, recordedConcurrency, numPods float64) int32 {
return int32(math.Floor(totCap/targetUtilization*numPods - targetBC - recordedConcurrency))
}

func expectedExcessBCF(originalReadyPodsCount int, totalValue, observedStableValue, targetBurstCapacity float64) float64 {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is the same as the method above just with different argument names and order

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 have combined these two tests and added PanicM.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant expectedEBC is an existing method. This method you wrote is a duplicate and can be removed.

@@ -65,6 +66,46 @@ func expectedEBC(totCap, targetBC, recordedConcurrency, numPods float64) int32 {
return int32(math.Floor(totCap/targetUtilization*numPods - targetBC - recordedConcurrency))
}

func expectedExcessBCF(originalReadyPodsCount int, totalValue, observedStableValue, targetBurstCapacity float64) float64 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I meant expectedEBC is an existing method. This method you wrote is a duplicate and can be removed.

a.expectScale(t, time.Now(), 5, expectedEBC(10, 100, 50, 1), true)
spec, podCounter := a.currentSpecAndPC()
originalReadyPodsCount, _ := podCounter.ReadyCount()
wantTags := map[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.

Shouldn't the tags be non-empty?
I think we create the autoscaler with empty context, but for this test we probably want a one with tags set to make sure we use the correct one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@MIBc MIBc force-pushed the auto-unit branch 2 times, most recently from 6c78af3 to 7540d70 Compare February 21, 2020 05:50
Copy link
Contributor

@vagababov vagababov left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MIBc, vagababov

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-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 21, 2020
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2020
@MIBc
Copy link
Contributor Author

MIBc commented Feb 21, 2020

/retest

@knative-prow-robot
Copy link
Contributor

@MIBc: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@taragu
Copy link
Contributor

taragu commented Feb 21, 2020

/ok-to-test

@knative-prow-robot knative-prow-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 21, 2020
@knative-test-reporter-robot

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-integration-tests pull-knative-serving-integration-tests 1/3

Automatically retrying due to test flakiness...
/test pull-knative-serving-integration-tests

@vagababov
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2020
@knative-prow-robot knative-prow-robot merged commit 11bb49c into knative:master Feb 21, 2020
@MIBc MIBc deleted the auto-unit branch February 22, 2020 08:23
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/autoscale cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

Add Unit Tests that verify stats reporting in autoscaler.
6 participants