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

Tests for setup plugin errors #3253

Merged
merged 8 commits into from
Aug 29, 2017
Merged

Tests for setup plugin errors #3253

merged 8 commits into from
Aug 29, 2017

Conversation

calvn
Copy link
Contributor

@calvn calvn commented Aug 29, 2017

Also refactored NewTestCluster to be able to create a cluster with an arbitrary number of cores.

@calvn calvn requested review from jefferai and briankassouf August 29, 2017 15:09
@@ -220,6 +273,28 @@ func testSystemBackendMock(t *testing.T, numMounts int, backendType logical.Back
return cluster
}

func ensureCoresSealed(t *testing.T, c *vault.TestCluster) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we maybe not have this function copied around somewhere yet again?

Let's start migrating such utility functions to a helper/testutil or so package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to testing.go since its a TestCluster operation

directoryPath := filepath.Dir(fullPath)

// Set core's plugin directory and plugin catalog directory
c.pluginDirectory = directoryPath
Copy link
Member

Choose a reason for hiding this comment

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

Why do we have both of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

setupPluginCatalog() uses c.pluginDirectory. If there is a unseal process during the test, the plugin loads from an empty directory and plugin mount fails:

"core: failed to create mount entry: path=mock-0/ error=no plugin found with name: mock-plugin"

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. 👍

Copy link
Member

@jefferai jefferai left a comment

Choose a reason for hiding this comment

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

Other than that one comment, looks good!

Copy link
Contributor

@briankassouf briankassouf left a comment

Choose a reason for hiding this comment

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

Looks good to me, curious why travis isn't running on this PR though. Would be nice to make sure the changes to the cluster setup didn't break other tests.

@calvn
Copy link
Contributor Author

calvn commented Aug 29, 2017

@briankassouf I think it's because this is not a merge to master. Travis should run when I open the PR on f-setup-plugins and merge against master :)

@briankassouf
Copy link
Contributor

@calvn Ah, didn't notice that 👍

@calvn
Copy link
Contributor Author

calvn commented Aug 29, 2017

@jefferai I also changed c.Cleanup() to use ensureCoresSealed() since it was pretty much the same code. I settled on a timeout of 10 seconds, but I can bump it back up to 60 if that's too short.

@jefferai
Copy link
Member

I'd bump it back up. Other testing code (especially on ent side) can take quite a bit longer to finish up tasks before sealing.

@calvn
Copy link
Contributor Author

calvn commented Aug 29, 2017

Bumped, merging if no objections.

@calvn calvn merged commit ee9098b into f-setup-plugins Aug 29, 2017
@calvn calvn deleted the test-setup-plugins branch August 29, 2017 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants