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

Bug-compatible refactor of docker-env + output tests #6527

Merged
merged 6 commits into from
Feb 7, 2020

Conversation

tstromberg
Copy link
Contributor

@tstromberg tstromberg commented Feb 6, 2020

The previous tests for docker-env did not provide much value, causing issues like #6524 to be both easy to introduce, and difficult to confidently fix.

This PR refactors docker-env to be trivially tested, by allowing it take only strings and a writer as inputs. This means we no longer have to mock out parts of libmachine, and we can now compare outputs.

This PR introduces no behavior changes or new tests. A follow-up PR will fix the following bugs I discovered:

  • If --unset and --no-proxy are used together, the output is corrupted
  • cmd, powershell, and emacs add a trailing tab to the script
  • cmd and powershell output contain an invalid newline
  • unset output has incorrect comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 6, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tstromberg

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 6, 2020
Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

Ah. Sorry about this mistake. I need to make windows test failures look like others ASAP

@medyagh
Copy link
Member

medyagh commented Feb 6, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Feb 6, 2020
@minikube-pr-bot
Copy link

Error: running mkcmp: exit status 1

@tstromberg tstromberg changed the title Revert whitespace change in docker-env output WIP: bug-compatible refactor of docker-env + tests Feb 6, 2020
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 6, 2020
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 6, 2020
@minikube-pr-bot
Copy link

All Times minikube: [ 93.982657 95.527866 92.615017]
All Times Minikube (PR 6527): [ 94.924589 97.897852 94.996733]

Average minikube: 94.041847
Average Minikube (PR 6527): 95.939725

Averages Time Per Log

+----------------------+-----------+--------------------+
|         LOG          | MINIKUBE  | MINIKUBE (PR 6527) |
+----------------------+-----------+--------------------+
| minikube v           |  0.127620 |           0.117489 |
| Creating kvm2        | 19.882912 |          19.857527 |
| Preparing Kubernetes | 49.387085 |          50.674750 |
| Pulling images       |  4.002997 |           3.457292 |
| Launching Kubernetes | 19.100134 |          19.904683 |
| Waiting for cluster  |  0.053628 |           0.071570 |
+----------------------+-----------+--------------------+

@tstromberg tstromberg changed the title WIP: bug-compatible refactor of docker-env + tests Bug-compatible refactor of docker-env + output tests Feb 6, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 6, 2020
@tstromberg
Copy link
Contributor Author

PTAL, I've repurposed this PR for cleanup-only work.

@minikube-pr-bot
Copy link

All Times Minikube (PR 6527): [ 95.758353 96.993859 96.684549]
All Times minikube: [ 96.778772 94.904052 96.517588]

Average minikube: 96.066804
Average Minikube (PR 6527): 96.478920

Averages Time Per Log

+----------------------+-----------+--------------------+
|         LOG          | MINIKUBE  | MINIKUBE (PR 6527) |
+----------------------+-----------+--------------------+
| minikube v           |  0.135747 |           0.123767 |
| Creating kvm2        | 19.697606 |          20.190388 |
| Preparing Kubernetes | 50.369065 |          49.980214 |
| Pulling images       |  3.862927 |           3.752001 |
| Launching Kubernetes | 20.259151 |          20.815988 |
| Waiting for cluster  |  0.055089 |           0.061804 |
+----------------------+-----------+--------------------+

@codecov-io
Copy link

codecov-io commented Feb 7, 2020

Codecov Report

Merging #6527 into master will decrease coverage by 0.04%.
The diff coverage is 58.03%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6527      +/-   ##
==========================================
- Coverage   37.95%   37.91%   -0.05%     
==========================================
  Files         138      137       -1     
  Lines        8708     8683      -25     
==========================================
- Hits         3305     3292      -13     
+ Misses       4986     4978       -8     
+ Partials      417      413       -4
Impacted Files Coverage Δ
cmd/minikube/cmd/env.go 57.81% <58.03%> (+0.89%) ⬆️
cmd/minikube/cmd/start.go 22.1% <0%> (-0.2%) ⬇️
pkg/minikube/bootstrapper/bootstrapper.go 0% <0%> (ø) ⬆️

@medyagh
Copy link
Member

medyagh commented Feb 7, 2020

Read half of it, looks very nice ! reading the rest

cmd/minikube/cmd/env.go Outdated Show resolved Hide resolved
@minikube-pr-bot
Copy link

All Times minikube: [ 94.496072 94.742602 90.992936]
All Times Minikube (PR 6527): [ 94.248907 94.779100 94.299592]

Average minikube: 93.410537
Average Minikube (PR 6527): 94.442533

Averages Time Per Log

+----------------------+-----------+--------------------+
|         LOG          | MINIKUBE  | MINIKUBE (PR 6527) |
+----------------------+-----------+--------------------+
| minikube v           |  0.136897 |           0.119398 |
| Creating kvm2        | 19.937192 |          19.884683 |
| Preparing Kubernetes | 50.257349 |          49.650694 |
| Pulling images       |           |           4.019329 |
| Launching Kubernetes | 21.281739 |          19.176318 |
| Waiting for cluster  |  0.237086 |           0.074410 |
+----------------------+-----------+--------------------+

@tstromberg tstromberg merged commit 10ef863 into kubernetes:master Feb 7, 2020
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants