GoogleCloudPlatform / cloud-foundation-toolkit

The Cloud Foundation toolkit provides GCP best practices as code.
Apache License 2.0
967 stars 457 forks source link

skip `.terraform` directories when searching for `discover_test.go` #1127

Closed daniel-cit closed 2 years ago

daniel-cit commented 2 years ago

when searching for the integration test directory the hidden terraform folders .terraform should be skipped.

during development, if we use make docker_test_lint all dependencies are downloaded into the .terraform directories , which includes a version of the git repository for the modules used.

An example from the foundation:

cft test list

Error: found multiple discover_test.go files: [
"/workspace/3-networks/envs/shared/.terraform/modules/base_transitivity.templates/test/integration/discover_test.go"
"/workspace/3-networks/envs/shared/.terraform/modules/restricted_transitivity.templates/test/integration/discover_test.go" 
"/workspace/3-networks/modules/transitivity/.terraform/modules/templates/test/integration/discover_test.go"
"/workspace/5-app-infra/business_unit_1/development/.terraform/modules/base_shared_gce_instance.instance_template/test/integration/discover_test.go"
"/workspace/5-app-infra/business_unit_1/non-production/.terraform/modules/base_shared_gce_instance.instance_template/test/integration/discover_test.go"
"/workspace/5-app-infra/business_unit_1/production/.terraform/modules/base_shared_gce_instance.instance_template/test/integration/discover_test.go"
"/workspace/5-app-infra/modules/env_base/.terraform/modules/instance_template/test/integration/discover_test.go"
]. 
Exactly one file was expected
bharathkkb commented 2 years ago

@daniel-cit what version is the CFT cli? I believe i fixed this in v0.4.4 via https://github.com/GoogleCloudPlatform/cloud-foundation-toolkit/pull/1108

daniel-cit commented 2 years ago

nice catch.

I am using

gcr.io/cloud-foundation-cicd/cft/developer-tools:1.4

with

cft  version
v0.4.3
daniel-cit commented 2 years ago

fix validated with version v0.4.4