Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@cpuguy83
Copy link
Member

@cpuguy83 cpuguy83 commented Mar 27, 2018

This was added as part of a53930a with
the intent to sort the mounts in the plugin config, but this was sorting
all the mounts from the default OCI spec which is problematic.

In reality we don't need to sort this because we are only adding a
self-binded mount to flag it as rshared.

We may want to look at sorting the plugin mounts before they are added
to the OCI spec in the future, but for now I think the existing behavior
is fine since the plugin author has control of the order (except for the
propagated mount).

Fixes #36698

Copy link
Contributor

Choose a reason for hiding this comment

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

Just for my knowledge. How does the new test framework run on specific OSes? For example, how does it achieve the old DaemonIsLinux condition?

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 is handled here: https://github.com/moby/moby/pull/36711/files#diff-ead2a878e85c5d12126b9757bff4cf69R24

And yes I totally added that after you said something :)

Also removed this check (which was a copy/paste from logging) since we don't need it here.

Copy link
Contributor

Choose a reason for hiding this comment

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

assert.NilError

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 is a copy-paste from the logging package... I don't know why it was changed to assert.Check... @dnephin ?

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 guess assert.Check just returns ok if the passed in value is nil. If it's not nil there's some switch on the type, and error types would fail the test.

Copy link
Member

@dnephin dnephin Mar 27, 2018

Choose a reason for hiding this comment

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

Yes, that's right. The automated migration converted testify/assert.NoError (which uses t.Fail()) to assert.Check() (which uses t.Fail()) because those have the equivalent behaviour. Checking errors with t.Fail() is generally going to be wrong and lead to a panic later in the test when something else is nil. So the original test was wrong to use testify/assert.NoError, and should have used testify/require.NoError.

gotestyourself/assert.NilError(t, err) is correct because it uses t.FailNow() and stops execution of the test.

I didn't fix every place that was using the wrong assertion, because there were many, but I tried to fix up a few.

@cpuguy83 cpuguy83 force-pushed the plugin_mounts_sorting branch from 75ba560 to 63501cc Compare March 27, 2018 21:11
@codecov
Copy link

codecov bot commented Mar 27, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@b6a7d02). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master   #36711   +/-   ##
=========================================
  Coverage          ?   34.96%           
=========================================
  Files             ?      613           
  Lines             ?    45556           
  Branches          ?        0           
=========================================
  Hits              ?    15928           
  Misses            ?    27541           
  Partials          ?     2087

@cpuguy83 cpuguy83 force-pushed the plugin_mounts_sorting branch from 63501cc to 4c550ef Compare March 27, 2018 21:19
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to add a function comment about expectations:
"DummyPluginSrc at cmd/dummy
DummyPluginInstallPath at $GOPATH/bin/dummy"

Copy link
Contributor

Choose a reason for hiding this comment

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

Not in this PR, but we should have a common set of helpers for all plugins, instead of duplicating code.

Copy link
Contributor

Choose a reason for hiding this comment

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

What is this lock protecting?

Copy link
Member Author

Choose a reason for hiding this comment

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

It makes sure that tests can run in parallel and that we only build a specific binary once.

Copy link
Contributor

Choose a reason for hiding this comment

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

For my clarification: So including the OCI defaults in the sort was overwriting the explicit /dev mounts from the plugin with the OCI defaults? Even so, how did it mess up the host /dev?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because it's adding things like a custom /dev/pts for the plugin, but if the host /dev is mounted in first this causes issues.

Copy link
Contributor

Choose a reason for hiding this comment

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

Janky panicked due to test case where m.Source is nil.

{Name: "pmount2", Settable: []string{"source"}, Type: "none"}, // Mount without source is invalid.

Please check for m.Source != nil

@cpuguy83 cpuguy83 force-pushed the plugin_mounts_sorting branch from 4c550ef to a8b4ddd Compare March 28, 2018 01:36
@vdemeester
Copy link
Member

@cpuguy83 validation failures 😓

01:46:10 integration/plugin/volumes/helpers_test.go:25:15:warning: GetEnv not declared by package os (gosimple)
01:46:10 integration/plugin/volumes/helpers_test.go:26:3:warning: ineffectual assignment to goPath (ineffassign)

@cpuguy83 cpuguy83 force-pushed the plugin_mounts_sorting branch 2 times, most recently from 39315c2 to fab5a51 Compare March 28, 2018 12:35
This was added as part of a53930a with
the intent to sort the mounts in the plugin config, but this was sorting
*all* the mounts from the default OCI spec which is problematic.

In reality we don't need to sort this because we are only adding a
self-binded mount to flag it as rshared.

We may want to look at sorting the plugin mounts before they are added
to the OCI spec in the future, but for now I think the existing behavior
is fine since the plugin author has control of the order (except for the
propagated mount).

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@anusha-ragunathan
Copy link
Contributor

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 🐯

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.