Skip to content

Completely remove deprecated d.NewClient from testing tools#38686

Merged
thaJeztah merged 1 commit intomoby:masterfrom
cpuguy83:remove_deprecated_newclient
Feb 21, 2019
Merged

Completely remove deprecated d.NewClient from testing tools#38686
thaJeztah merged 1 commit intomoby:masterfrom
cpuguy83:remove_deprecated_newclient

Conversation

@cpuguy83
Copy link
Member

@cpuguy83 cpuguy83 commented Feb 6, 2019

Favor d.NewClientT instead.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM 🤗

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐯

@thaJeztah
Copy link
Member

oh, hm.. looks like this needs some changes;

08:56:25 internal/test/daemon/swarm.go:135:1:warning: comment on exported method Daemon.SwarmUnlock should be of the form "SwarmUnlock ..." (golint)
08:56:25 client/swarm_unlock_test.go:44:28:warning: cannot use t (variable of type *testing.T) as context.Context value in argument to client.SwarmUnlock: missing method Deadline (gosimple)

@thaJeztah thaJeztah added status/2-code-review status/failing-ci Indicates that the PR in its current state fails the test suite and removed status/4-merge labels Feb 7, 2019
@cpuguy83 cpuguy83 force-pushed the remove_deprecated_newclient branch from 612dc96 to 4ffbed5 Compare February 7, 2019 18:57
@cpuguy83
Copy link
Member Author

cpuguy83 commented Feb 7, 2019

Oops. Pushed an update to fix.

@cpuguy83 cpuguy83 force-pushed the remove_deprecated_newclient branch from 4ffbed5 to 820d710 Compare February 7, 2019 19:09
@thaJeztah thaJeztah removed the status/failing-ci Indicates that the PR in its current state fails the test suite label Feb 7, 2019
Favor `d.NewClientT` instead.

Signed-off-by: Brian Goff <[email protected]>
@cpuguy83 cpuguy83 force-pushed the remove_deprecated_newclient branch from 820d710 to e063099 Compare February 8, 2019 00:08
@codecov
Copy link

codecov bot commented Feb 8, 2019

Codecov Report

Merging #38686 into master will decrease coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master   #38686      +/-   ##
==========================================
- Coverage   36.56%   36.53%   -0.03%     
==========================================
  Files         610      610              
  Lines       45395    45395              
==========================================
- Hits        16598    16587      -11     
- Misses      26505    26510       +5     
- Partials     2292     2298       +6

@cpuguy83
Copy link
Member Author

cpuguy83 commented Feb 8, 2019

Ok, all green. Want to double-check?

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

left one question that I wasn't entirely sure of, but otherwise still looks sane to me

return f(c, t)
func withClient(t assert.TestingT, d *Daemon, f func(client.APIClient, poll.LogT) poll.Result) func(poll.LogT) poll.Result {
return func(pt poll.LogT) poll.Result {
c := d.NewClientT(t)
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if there's a need to use poll.Error here? In that case perhaps we should inline ~ what NewClientT does here

Suggested change
c := d.NewClientT(t)
if ht, ok := t.(test.HelperT); ok {
ht.Helper()
}
c, err := client.NewClientWithOpts(
client.FromEnv,
client.WithHost(d.Sock()))
if err != nil {
poll.Error(err)
}

@vdemeester ?

Copy link
Member

Choose a reason for hiding this comment

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

NewClientT will mark the build as fail (and fatal), so I'm pretty sure it will get out of the poll loop in case of failure… but I'm not 100% sure about that.
cc @dnephin

Copy link
Member

Choose a reason for hiding this comment

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

Ya, that sounds right. t.Fatal will panic and stop execution.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @dnephin - looks like ready to merge then 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants