Skip to content

Commit

Permalink
Sanitize snapshots (#1002)
Browse files Browse the repository at this point in the history
* sanitize snapshots

* [autofix.ci] apply automated fixes

* check for empty repo root

* normalize slashes

* normalize slashes

* try to fix windows snapshots with windows paths

* handle multiple slashes

* handle multiple slashes

* changed strategy for removing double slashes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and Cerebrovinny committed Feb 5, 2025
1 parent 71f849c commit 5a06a42
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 36 deletions.
1 change: 1 addition & 0 deletions tests/fixtures/scenarios/mock-terraform/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ stacks:
- "**/*"
excluded_paths:
- "**/templates/**/*"
name_pattern: "{environment}-{component}"

logs:
file: "/dev/stderr"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
backend "local" {
workspace_dir = "terraform.tfstate.d"
path = "terraform.tfstate"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
variable "stage" {
type = string
}

variable "environment" {
type = string
}

variable "tenant" {
type = string
}

variable "foo" {
type = string
default = "foo"
Expand All @@ -13,11 +25,15 @@ variable "baz" {
default = "baz"
}

# Mock resource for testing
resource "local_file" "mock" {
content = jsonencode({
foo = var.foo
bar = var.bar
baz = var.baz
stage = var.stage
environment = var.environment
tenant = var.tenant
})
filename = "${path.module}/mock.json"
}
Expand All @@ -33,3 +49,15 @@ output "bar" {
output "baz" {
value = var.baz
}

output "stage" {
value = var.stage
}

output "environment" {
value = var.environment
}

output "tenant" {
value = var.tenant
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"bar":"dev-bar","baz":"dev-baz","foo":"dev-foo"}
{"bar":"dev-bar","baz":"dev-baz","environment":"dev","foo":"dev-foo","stage":"dev","tenant":"test"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
terraform {
required_version = ">= 1.0.0"


required_providers {
local = {
source = "hashicorp/local"
Expand Down
17 changes: 0 additions & 17 deletions tests/fixtures/scenarios/mock-terraform/stacks/catalog/mock.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
components:
terraform:
mock:
metadata:
component: mock
backend:
type: local
settings:
component: mock
vars:
foo: "catalog-foo"
bar: "catalog-bar"
baz: "catalog-baz"
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import:
- catalog/mock

vars:
environment: dev
component: mock
- ../catalog/terraform/mock

components:
terraform:
mock:
metadata:
component: mock
environment: dev
settings:
component: mock
backend:
type: local
vars:
stage: dev
environment: dev
tenant: test
foo: "dev-foo"
bar: "dev-bar"
baz: "dev-baz"
baz: "dev-baz"
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import:
- catalog/mock

vars:
environment: prod
component: mock
- ../catalog/terraform/mock

components:
terraform:
mock:
metadata:
component: mock
environment: prod
settings:
component: mock
backend:
type: local
vars:
stage: prod
environment: prod
tenant: test
foo: "prod-foo"
bar: "prod-bar"
baz: "prod-baz"
baz: "prod-baz"

0 comments on commit 5a06a42

Please sign in to comment.