-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathcli_test.go
More file actions
72 lines (61 loc) · 1.94 KB
/
Copy pathcli_test.go
File metadata and controls
72 lines (61 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package graph_test
import (
"path/filepath"
"testing"
"github.com/gruntwork-io/terragrunt/internal/cli/commands/dag/graph"
"github.com/gruntwork-io/terragrunt/pkg/options"
"github.com/gruntwork-io/terragrunt/test/helpers/logger"
"github.com/stretchr/testify/require"
)
// Run a benchmark on runGraphDependencies for all fixtures possible.
// This should reveal regression on execution time due to new, changed or removed features.
func BenchmarkRunGraphDependencies(b *testing.B) {
// Setup
b.StopTimer()
testDir := "../../../../../test/fixtures"
fixtureDirs := []struct {
description string
workingDir string
usePartialParseCache bool
}{
{
"PartialParseBenchmarkRegressionCaching",
"regressions/benchmark-parsing/production/deployment-group-1/webserver/terragrunt.hcl",
true,
},
{
"PartialParseBenchmarkRegressionNoCache",
"regressions/benchmark-parsing/production/deployment-group-1/webserver/terragrunt.hcl",
false,
},
{
"PartialParseBenchmarkRegressionIncludesCaching",
"regressions/benchmark-parsing-includes/production/deployment-group-1/webserver/terragrunt.hcl",
true,
},
{
"PartialParseBenchmarkRegressionIncludesNoCache",
"regressions/benchmark-parsing-includes/production/deployment-group-1/webserver/terragrunt.hcl",
false,
},
}
// Run benchmarks
for _, fixture := range fixtureDirs {
b.Run(fixture.description, func(b *testing.B) {
workingDir, err := filepath.Abs(filepath.Join(testDir, fixture.workingDir))
require.NoError(b, err)
terragruntOptions, err := options.NewTerragruntOptionsForTest(workingDir)
if fixture.usePartialParseCache {
terragruntOptions.UsePartialParseConfigCache = true
} else {
terragruntOptions.UsePartialParseConfigCache = false
}
require.NoError(b, err)
b.ResetTimer()
b.StartTimer()
err = graph.Run(b.Context(), logger.CreateLogger(), terragruntOptions)
b.StopTimer()
require.NoError(b, err)
})
}
}