8000 Use vol plugin creator instead of inserting spec by cpuguy83 · Pull Request #29894 · moby/moby · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use vol plugin creator instead of inserting spec #29894

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

Merged
merged 2 commits into from
Feb 17, 2017

Conversation

cpuguy83
Copy link
Member
@cpuguy83 cpuguy83 commented Jan 4, 2017

This makes the test a bit more robust to change and is a bit cleaner.
As implemented before this commit, we have two named plugins pointing to
the same http service. If the daemon makes any unexpected calls to the
plugin (e.g. during startup) we'll get more counts on the event counter
than expected since the daemon sees 2 plugins.

Found this while working on #29877 which broke this test originally (but
is no longer using V1 plugins, so is this is no longer broken there) and
took some time to debug what was going on.

This makes the test a bit more robust to change and is a bit cleaner.
As implemented before this commit, we have two named plugins pointing to
the same http service. If the daemon makes any unexpected calls to the
plugin (e.g. during startup) we'll get more counts on the event counter
than expected since the daemon sees 2 plugins.

Found this while working on moby#29877 which broke this test originally (but
is no longer using V1 plugins, so is this is no longer broken there) and
took some time to debug what was going on.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
go func() {
if out, err := s.d.Cmd("run", "--rm", "--name", "test-data-retry", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", "test-external-volume-driver-retry", "busybox:latest"); err != nil {
close(started)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this trick. I saw it before and still think it's extremely weird.

Copy link
Member Author

Choose a reason for hiding this comment

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

This should stay running until the plugin timeout is reached (like 13 seconds or something?)

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand what should stay running :)
Code looks like:

	started := make(chan struct{})
	go func() {
		close(started)

Now I think it's sort of mistake, because there is no way you would need this in tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm sorry I'm not understanding what you are saying here.

Copy link
Contributor

Choose a reason for hiding this comment

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

	started := make(chan struct{})
	go func() {
		close(started)
		if out, err := s.d.Cmd("run", "--rm", "--name", "test-data-retry", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", driverName, "busybox:latest"); err != nil {
			errchan <- fmt.Errorf("%v:\n%s", err, out)
		}
		close(errchan)
	}()

What the point of started chan?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just making sure the test doesn't flake out because the goroutine hasn't started yet, but later we are only waiting some fixed amount of time.


<-started
// wait for a retry to occur, then create spec to allow plugin to register
time.Sleep(2000 * time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

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

2 * time.Second

@LK4D4
Copy link
Contributor
LK4D4 commented Jan 26, 2017

Left some comments.

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Feb 10, 2017
Signed-off-by: Daniel Nephin <dnephin@docker.com>
@dnephin dnephin force-pushed the cleanup_volumedriver_retry_test branch from 1c5b0cf to cbf2f4d Compare February 10, 2017 16:30
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Feb 10, 2017
Copy link
Member
@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

LGTM

@LK4D4 I fixed the 2 * time.Second, please take a look

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 🐸

@cpuguy83
Copy link
Member Author

Good to merge?

@vdemeester
Copy link
Member

Yes !

@vdemeester vdemeester merged commit d07cd8c into moby:master Feb 17, 2017
@GordonTheTurtle GordonTheTurtle added this to the 1.14.0 milestone Feb 17, 2017
@cpuguy83 cpuguy83 deleted the cleanup_volumedriver_retry_test branch September 20, 2017 16:53
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.

5 participants
0