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

make failing test showing spurious variable conflicts #1634

Merged
merged 3 commits into from
Oct 15, 2019

Conversation

tkellen
Copy link
Contributor

@tkellen tkellen commented Oct 15, 2019

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 15, 2019
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 15, 2019
@tkellen
Copy link
Contributor Author

tkellen commented Oct 15, 2019

/assign @monopole

@tkellen
Copy link
Contributor Author

tkellen commented Oct 15, 2019

Not sure I went as far as you'd like with the functional "sugar" for the tests @monopole, but I tried to clean it up in a way that I felt would be much more readable for future maintainers.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tkellen
To complete the pull request process, please assign monopole
You can assign the PR to them by writing /assign @monopole in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 15, 2019
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 15, 2019

func makeVarToNamepaceAndPath(
name string,
namespace string,
Copy link
Contributor

Choose a reason for hiding this comment

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

namespace isn't used, did you mean env?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops. No, I did mean to use it, though clearly it isn't strictly required I felt it helped illustrate my particular incarnation of this issue. I've updated this.

}
}

func TestResolveVarConflicts(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this test reads like an example, which is perfect. thanks!

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 pleasure, thanks for prompting me to take a bit more care.

// value do not produce a conflict.
err := ac0.MergeAccumulator(ac1)
if err != nil {
t.Fatalf("dupe var names w/ same concrete val should not conflict: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

so the current form of this test should be

if err == nil {
  t.Fatalf("see bug whatever")
}

the subsequent PR to fix that bug should change this line.

we cannot check in failing tests, but we can check in tests that succeed showing behavior we want to change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Updated this and the now-dependent PR.

@monopole monopole merged commit 2734085 into kubernetes-sigs:master Oct 15, 2019
@tkellen tkellen deleted the gh-1600-failing branch October 15, 2019 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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.

3 participants