Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

pkg/terraform: improvements #1027

Merged
merged 7 commits into from
Oct 5, 2020
Merged

Conversation

invidian
Copy link
Member

Part of #1023.

@invidian invidian force-pushed the invidian/terraform-errors-improvements branch from 0479ff6 to 78abf0a Compare September 28, 2020 13:16
@invidian invidian requested review from knrt10 and surajssd September 28, 2020 13:39
Copy link
Member

@knrt10 knrt10 left a comment

Choose a reason for hiding this comment

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

Some Nits, rest LGTM

pkg/terraform/executor_e2e_test.go Show resolved Hide resolved
pkg/terraform/executor_internal_test.go Show resolved Hide resolved
pkg/terraform/executor.go Outdated Show resolved Hide resolved
pkg/terraform/executor_test.go Show resolved Hide resolved
Also use t.Cleanup() instead of defer to cleanup after tests.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
So regular unit tests for executor can be run.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Rather than in runtime.

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
@invidian invidian force-pushed the invidian/terraform-errors-improvements branch from 78abf0a to 300075b Compare September 30, 2020 10:09
@invidian invidian requested a review from knrt10 September 30, 2020 10:09
return fmt.Errorf("checking Terraform version: %w", err)
}
// requiredVersion is const, so we test it in unit tests.
constraints, _ := version.NewConstraint(requiredVersion)
Copy link
Member

Choose a reason for hiding this comment

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

we can log it in debug mode? So we don't lose track of it altogether.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why? It is covered by unit tests, running exactly the same code.

Copy link
Member

Choose a reason for hiding this comment

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

It's best to panic in such case, if this error should be found during development itself.

// See the License for the specific language governing permissions and
// limitations under the License.

//+build e2e
Copy link
Member

Choose a reason for hiding this comment

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

Should e2e tests sit in test dir? Mixing unit tests and e2e 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.

IMO, those are package-scoped tests, so I think it's fine if they sit in this directory. They are marked as e2e, as they require external dependency to pass (terraform binary).

@invidian invidian requested a review from surajssd October 1, 2020 09:18
Copy link
Member

@knrt10 knrt10 left a comment

Choose a reason for hiding this comment

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

Looks great

Copy link
Member

@surajssd surajssd left a comment

Choose a reason for hiding this comment

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

ok

@invidian invidian merged commit 7ed9ab8 into master Oct 5, 2020
@invidian invidian deleted the invidian/terraform-errors-improvements branch October 5, 2020 09:49
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