diff --git a/docs/docs/configuration.md b/docs/docs/configuration.md index c2b415a..ae5b480 100644 --- a/docs/docs/configuration.md +++ b/docs/docs/configuration.md @@ -1,6 +1,6 @@ # Configuration -*infra-tester* uses [**YAML**](https://yaml.org/) as its configuration language and supports most of YAML 1.1 and 1.2, including support for anchors, tags, map merging, etc. When *infra-tester* is run, it looks for a `config.yaml` file in the current directory to run the tests. +*infra-tester* uses [**YAML**](https://yaml.org/) as its configuration language and supports most of YAML 1.1 and 1.2, including support for anchors, tags, map merging, etc. When *infra-tester* is run, it looks for a `.infra-tester-config.yaml` file in the current directory to run the tests. The configuration for *infra-tester* has the following structure: diff --git a/docs/docs/extending_infra_tester.md b/docs/docs/extending_infra_tester.md index 812e59a..073acc8 100644 --- a/docs/docs/extending_infra_tester.md +++ b/docs/docs/extending_infra_tester.md @@ -281,9 +281,9 @@ This section shows an example package that provides two plugins: --8<-- "example/plugin-example/pyproject.toml" ``` -=== "Usage in config.yaml" +=== "Usage in .infra-tester-config.yaml" - ```yaml linenums="42" title="example/config.yaml" + ```yaml linenums="42" title="example/.infra-tester-config.yaml" ... - name: ExamplesCustomAssertions apply: diff --git a/docs/docs/writing_tests.md b/docs/docs/writing_tests.md index 9075e5c..4fb06f4 100644 --- a/docs/docs/writing_tests.md +++ b/docs/docs/writing_tests.md @@ -61,11 +61,11 @@ A basic test would be a regular expression matching to make sure the output adheres to the RFC 3339 format. Let's see how we can write such a test using *infra-tester*. -Let's create a `config.yaml` file in the same directory where we created the +Let's create a `.infra-tester-config.yaml` file in the same directory where we created the Terraform file and copy the below code into it. See the annotation next to the code to understand what it does. -```yaml title="config.yaml" linenums="1" +```yaml title=".infra-tester-config.yaml" linenums="1" test_plan: name: Time #(1) tests: # (2) @@ -102,7 +102,7 @@ The above configuration is all that's required to test the use case we mentioned ## Running the Tests Change the working directory to the same directory where you created the Terraform -file and the `config.yaml` file and run +file and the `.infra-tester-config.yaml` file and run ```shell infra-tester -test.v @@ -129,7 +129,7 @@ Let's modify the regular expression so that it's invalid and see what happens. To make it invalid let's remove the first two opening brackets, so the line would then be: -```yaml title="config.yaml" linenums="10" +```yaml title=".infra-tester-config.yaml" linenums="10" regex: ^?:(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}(?:\.\d+)?))(Z|[\+-]\d{2}:\d{2})?)$ ``` @@ -153,7 +153,7 @@ easy-to-catch issues. This leads to a better developer experience. Let us now try to pass it a valid regular expression but one that doesn't adhere to RFC 3339. Let's modify the line to the following: -```yaml title="config.yaml" linenums="10" +```yaml title=".infra-tester-config.yaml" linenums="10" regex: ^((?:T(\d{2}:\d{2}:\d{2}(?:\.\d+)?))(Z|[\+-]\d{2}:\d{2})?)$ ``` diff --git a/example/config.yaml b/example/.infra-tester-config.yaml similarity index 100% rename from example/config.yaml rename to example/.infra-tester-config.yaml diff --git a/src/main_test.go b/src/main_test.go index 3903d3c..1ab5806 100644 --- a/src/main_test.go +++ b/src/main_test.go @@ -212,7 +212,7 @@ func runApplyAssertions( } func getTests() (TestPlan, error) { - yamlConfig, err := os.ReadFile("config.yaml") + yamlConfig, err := os.ReadFile(".infra-tester-config.yaml") if err != nil { return TestPlan{}, fmt.Errorf("failed to read yaml config: %v", err) }