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

Use t.Logf instead of glog in tests #248

Merged
merged 3 commits into from
Jul 12, 2019

Conversation

corneliusweig
Copy link
Contributor

Fix #247

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 8, 2019
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 8, 2019
@codecov-io
Copy link

codecov-io commented Jul 8, 2019

Codecov Report

Merging #248 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #248   +/-   ##
======================================
  Coverage    53.6%   53.6%           
======================================
  Files          16      16           
  Lines         735     735           
======================================
  Hits          394     394           
  Misses        289     289           
  Partials       52      52

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3951c05...8c91c6e. Read the comment docs.

@@ -34,3 +35,11 @@ if [[ -n "$out" ]]; then
echo >&2 "$out"
exit 1
fi

# Do not use glog in test code
out="$(grep --include '*_test.go' --exclude-dir 'vendor/' -EIrn 'github.com/golang/glog' || true)"
Copy link
Member

Choose a reason for hiding this comment

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

I recommend making the pattern based on invocation [kg]log\. as we might move to klog at some point (in fact we probably should). Similarly, import paths are more likely to change than the usage (e.g. this could change to golang.org/glog someday).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thought was to avoid false positives as glog is rather short. But for now there are no collisions and we can think of a better way if a collision should occur. 👍

@@ -25,3 +34,42 @@ func TestKrewInstall(t *testing.T) {
test.WithIndex().Krew("install", validPlugin).RunOrFailOutput()
test.AssertExecutableInPATH("kubectl-" + validPlugin)
}

func TestKrewInstall_Manifest(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

I think the other PR got mixed in here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gosh, how embarrassing 🙄

@@ -166,7 +165,7 @@ func (it *ITest) WithIndex() *ITest {
// WithEnv sets an environment variable for the krew run.
func (it *ITest) WithEnv(key string, value interface{}) *ITest {
if key == "KREW_ROOT" {
glog.V(1).Infoln("Overriding KREW_ROOT in tests is forbidden")
it.t.Log("Overriding KREW_ROOT in tests is forbidden")
Copy link
Member

Choose a reason for hiding this comment

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

out of scope but I think this is more suitable for a t.Fatal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a small but important thing, so I changed that.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 9, 2019
@ahmetb
Copy link
Member

ahmetb commented Jul 12, 2019

/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 Jul 12, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmetb, corneliusweig

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:
  • OWNERS [ahmetb,corneliusweig]

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 merged commit 697dd32 into kubernetes-sigs:master Jul 12, 2019
@corneliusweig corneliusweig deleted the w/no-glog-in-tests branch July 12, 2019 20:56
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

integration_test: prevent usage of glog, move to t.Logf
4 participants