Skip to content

Commit d6239f9

Browse files
committed
Add VS code debug configurations
Add debug configuration to launch debug with predefined env vars.
1 parent e76519f commit d6239f9

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ terraform.tfstate.*.backup
66

77
# MacOS
88
.DS_Store
9+
10+
debug.test

.vscode/launch.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Debug all tests",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "test",
12+
"program": "${file}",
13+
"args": ["-test.v"],
14+
"envFile": "${workspaceRoot}/test.env",
15+
"showLog": true
16+
},
17+
{
18+
"name": "Debug test fn",
19+
"type": "go",
20+
"request": "launch",
21+
"mode": "test",
22+
"program": "${file}",
23+
"args": [
24+
// To debug only one test fn
25+
// "-test.run", "TestMyFunction"
26+
"-test.v"
27+
],
28+
"envFile": "${workspaceRoot}/test.env",
29+
"showLog": true
30+
}
31+
],
32+
"compounds": [
33+
{
34+
"name": "Cache",
35+
"configurations": ["Debug all tests", "Debug test fn"],
36+
"preLaunchTask": "clean cache"
37+
}
38+
]
39+
}

.vscode/tasks.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "clean cache",
6+
"type": "shell",
7+
"command": "go clean -testcache"
8+
}
9+
]
10+
}

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ Set env variable `TF_LOG=DEBUG` to see additional output.
359359

360360
Use `printState()` function to discover terraform state (and resource props) during test.
361361

362+
Debug configurations are also available for VS Code.
363+
362364
## Author
363365

364366
[Datadrivers GmbH](https://www.datadrivers.de)

test.env

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
TF_LOG=DEBUG
2+
TF_ACC=1
3+
SKIP_S3_TESTS=1
4+
NEXUS_URL=http://127.0.0.1:8081
5+
NEXUS_USERNAME=admin
6+
NEXUS_PASSWORD=admin123

0 commit comments

Comments
 (0)