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

to e2e, or not e2e, that is the question #22918

Merged
merged 4 commits into from
Sep 27, 2019

Conversation

mildwonkey
Copy link
Contributor

While working on a new feature I found that certain e2e tests had not been updated for 0.12. This sent me down a bit of a rabbit trail getting the e2e tests to either pass or (in the case of backends) fail cleanly. (The first two commits represent tests I needed to get working for my feature while the latter two were fixed merely because the messiness of the failures annoyed me).

Some of these backend failures might represent bugs in the backend themselves (such as etcv3] but overall it seemed that the tests were simply making assumptions about env vars being set, then failing in weird ways when that was not the case.

I did find one clear bug in the manta backend: a bool attribute was defaulting to "" and causing a panic, so I updated it to false (matching the documented default).

versions

The terraform version was hard-coded to 0.10.2, and the provider
versions supported the older provider protocol version 4.
filepath.EvalSymlinks is our friend! The code already does this, the
tests needed to be updated to do the same.
The DefaultFunc for insecure_skip_tls_verify was sending an empty string
instead of a bool. Fixes to default to `false`.
@mildwonkey mildwonkey requested a review from a team September 26, 2019 15:39
@ghost ghost added the sdkv1 [PRs only] Marks changes that may potentially need to be ported to the plugi nSDK label Sep 26, 2019
Copy link
Contributor

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

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

Some little bits inline, but this looks great! Thanks for fixing these up.

@@ -131,6 +131,9 @@ func (b *Backend) configure(ctx context.Context) error {
if data.Get("key_id").(string) == "" {
validationError = multierror.Append(validationError, errors.New("`Key ID` must be configured for the Triton provider"))
}
if data.Get("key_id").(string) == "" {
validationError = multierror.Append(validationError, errors.New("`Key ID` must be configured for the Triton provider"))
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems the same as the block above it ... 🤔 is there a subtle difference I'm not seeing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! The difference is "I need to update that with the correct attribute" 🤣 thank you so much

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On second thought, that shouldn't be in there at all - removed!

@@ -19,7 +19,11 @@ func TestDirFromModule_registry(t *testing.T) {
}

fixtureDir := filepath.Clean("testdata/empty")
dir, done := tempChdir(t, fixtureDir)
tmpDir, done := tempChdir(t, fixtureDir)
dir, err := filepath.EvalSymlinks(tmpDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a little comment above here explaining why this is necessary? It's surprising that a tempChdir result would need EvalSymlinks applied to it but I'm sure there was a reason! 😀

(Similarly for the other EvalSymlinks calls elsewhere here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! Added a comment!

For PR posterity: The module installer runs filepath.EvalSymlinks on the destination directory, and the result of that is what's returned by the install hooks. If you are on, for eg, a mac whose TMPDIR env var points to a symlinked directory, the tests - which compare expected installation dir with what's returned by the install hooks - would fail.

I could also (easily) make the tests path by changing my machine's configured TMPDIR to a non-symlinked directory, but as I suspect this impacts most folks using mac osx and developing locally, I felt it was worth addressing in the test.

faster

The acceptance tests for etcdv3, oss and manta were not validating
required env variablea, chosing to assume that if one was running
acceptance tests they had already configured the credentials.

It was not always clear if this was a bug in the tests or the provider,
so I opted to make the tests fail faster when required attributes were
unset (or "").
@mildwonkey mildwonkey force-pushed the mildwonkey/to-e2e-or-not-e2e branch from 1c7a18d to 68dfc30 Compare September 27, 2019 12:45
@mildwonkey mildwonkey merged commit 006ef02 into master Sep 27, 2019
@mildwonkey mildwonkey deleted the mildwonkey/to-e2e-or-not-e2e branch September 27, 2019 12:46
appilon pushed a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Oct 23, 2019
@ghost
Copy link

ghost commented Oct 28, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Oct 28, 2019
@appilon appilon removed the sdkv1 [PRs only] Marks changes that may potentially need to be ported to the plugi nSDK label Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants