Skip to content

Commit 065d61d

Browse files
committed
feat: Adding tests for scaffold
1 parent 6759544 commit 065d61d

File tree

8 files changed

+759
-0
lines changed

8 files changed

+759
-0
lines changed

cli/commands/scaffold/scaffold_test.go

Lines changed: 691 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Terragrunt configuration for testing catalog config override behavior
2+
catalog {
3+
urls = ["../with-shell-and-hooks"]
4+
no_shell = true
5+
no_hooks = true
6+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
variables:
2+
- name: TestVariable
3+
description: A test variable
4+
type: string
5+
default: "test-value"
6+
7+
hooks:
8+
before:
9+
- command: echo "BEFORE_HOOK_EXECUTED"
10+
description: "Test hook that should execute before rendering"
11+
after:
12+
- command: echo "AFTER_HOOK_EXECUTED"
13+
description: "Test hook that should execute after rendering"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Test template with hooks
2+
terraform {
3+
source = "git::https://github.com/gruntwork-io/terragrunt.git//test/fixtures/inputs?ref=v0.53.8"
4+
}
5+
6+
inputs = {
7+
test_var = "{{ .TestVariable }}"
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
variables:
2+
- name: TestVariable
3+
description: A test variable
4+
type: string
5+
default: "test-value"
6+
7+
hooks:
8+
before:
9+
- command: echo "BEFORE_HOOK_EXECUTED"
10+
description: "Test hook before rendering"
11+
after:
12+
- command: echo "AFTER_HOOK_EXECUTED"
13+
description: "Test hook after rendering"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Test template with both shell template functions and hooks
2+
terraform {
3+
source = "git::https://github.com/gruntwork-io/terragrunt.git//test/fixtures/inputs?ref=v0.53.8"
4+
}
5+
6+
inputs = {
7+
test_var = "{{ .TestVariable }}"
8+
# This uses the shell template function
9+
current_user = "{{ shell "whoami" }}"
10+
timestamp = "{{ shell "date +%s" }}"
11+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
variables:
2+
- name: TestVariable
3+
description: A test variable
4+
type: string
5+
default: "test-value"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Test template with shell template function
2+
terraform {
3+
source = "git::https://github.com/gruntwork-io/terragrunt.git//test/fixtures/inputs?ref=v0.53.8"
4+
}
5+
6+
inputs = {
7+
test_var = "{{ .TestVariable }}"
8+
# This should execute a shell command when NoShell = false
9+
current_date = "{{ shell "date +%Y-%m-%d" }}"
10+
# This should execute another shell command
11+
whoami = "{{ shell "whoami" }}"
12+
}

0 commit comments

Comments
 (0)