Skip to content

Commit cb6cb61

Browse files
committed
test: add empty configuration test scenario
1 parent 5503cea commit cb6cb61

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,18 @@ terraform -chdir=terraform plan
245245
terraform -chdir=terraform apply
246246
```
247247

248+
## Development
249+
250+
Format Terraform configuration by `terraform -chdir=terraform fmt -recursive`.
251+
248252
## Testing
249253

254+
### Terraform Test
255+
256+
Run test scenarios in [`terraform/tests`](terraform/tests/) by `terraform -chdir=terraform test`.
257+
258+
### End-to-end Tessting
259+
250260
This repository is tested using [`test.yaml`](test.yaml) as the configuration file for the [Xebis Test GitHub Organization](https://github.com/xebis-test) settings and repositories.
251261

252262
The workflow is designed to post a Terraform plan as a pull request comment whenever a pull request to the main branch is created or whenever a new commit to the pull request is pushed. Once the pull request is merged into `main`, the plan is applied automatically.

terraform/tests/empty.tftest.hcl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
run "empty_file" {
2+
command = plan
3+
4+
variables {
5+
path = "tests/fixtures/empty.yaml"
6+
}
7+
8+
assert {
9+
condition = local.config == null
10+
error_message = "Expected empty file to produce empty result."
11+
}
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
---

0 commit comments

Comments
 (0)