-
Notifications
You must be signed in to change notification settings - Fork 178
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
Unit tests improvements #139
Unit tests improvements #139
Conversation
Test metric on metrics' freshness when a metric timestamp is in the future.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: olivierlemasle 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 |
Refactor the test using testify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started having a look, I will most likely get back to it later, but I am wondering if we should just straight up rewrite the unit tests from scratch. Today what we have can hardly be called unit testing considering the amount of things that are tested in a single test. wdyt?
@@ -260,60 +194,85 @@ func TestCustomMetricsAPI(t *testing.T) { | |||
|
|||
cases := map[string]T{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking note that can be applied to most of the unit tests in the codebase, we should migrate to anonymous struct defined per test for the cases. There are a few fields here that don't change for this test and could be remove. Also, it would be easier to understand the difference between each case if they were declared with each field properly specified instead of inlining them.
Since this PR is already quite beefy, it would be better to do that in a separate effort.
/triage accepted |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
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. |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to this:
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. |
TestFreshness
: test the case where a metric timestamp is in the futurepkg/apiserver/installer/apiserver_test.go
andpkg/cmd/builder_test.go
, to replace the other fake/test implementations of the Provider interface. Remove thefake
implementation that I've added recently (in Serve OpenAPI spec by default #110).It might be easier to review this PR commit by commit (one commit per item in the list above). I can split the PR if you prefer.