diff --git a/pkg/analyser/analysis.go b/pkg/analyser/analysis.go index 39a811e7..1c9cb52f 100644 --- a/pkg/analyser/analysis.go +++ b/pkg/analyser/analysis.go @@ -73,6 +73,10 @@ type GenDriftIgnoreOptions struct { OutputPath string } +func NewAnalysis(options AnalyzerOptions) Analysis { + return Analysis{options: options} +} + func (a Analysis) MarshalJSON() ([]byte, error) { bla := serializableAnalysis{} for _, m := range a.managed { diff --git a/pkg/cmd/scan/output/console_test.go b/pkg/cmd/scan/output/console_test.go index 09a6fd58..79f0e780 100644 --- a/pkg/cmd/scan/output/console_test.go +++ b/pkg/cmd/scan/output/console_test.go @@ -31,7 +31,7 @@ func TestConsole_Write(t *testing.T) { name: "test console output", goldenfile: "output.txt", args: args{analysis: func() *analyser.Analysis { - a := fakeAnalysis() + a := fakeAnalysis(analyser.AnalyzerOptions{}) a.AddDeleted( &resource.Resource{ Id: "test-id-1", diff --git a/pkg/cmd/scan/output/json_test.go b/pkg/cmd/scan/output/json_test.go index 3ee0482c..32915388 100644 --- a/pkg/cmd/scan/output/json_test.go +++ b/pkg/cmd/scan/output/json_test.go @@ -28,7 +28,7 @@ func TestJSON_Write(t *testing.T) { name: "test json output", goldenfile: "output.json", args: args{ - analysis: fakeAnalysis(), + analysis: fakeAnalysis(analyser.AnalyzerOptions{}), }, wantErr: false, }, @@ -103,7 +103,7 @@ func TestJSON_Write_stdout(t *testing.T) { goldenfile: "output.json", path: "stdout", args: args{ - analysis: fakeAnalysis(), + analysis: fakeAnalysis(analyser.AnalyzerOptions{}), }, wantErr: false, }, @@ -113,7 +113,7 @@ func TestJSON_Write_stdout(t *testing.T) { goldenfile: "output.json", path: "/dev/stdout", args: args{ - analysis: fakeAnalysis(), + analysis: fakeAnalysis(analyser.AnalyzerOptions{}), }, wantErr: false, }, @@ -160,7 +160,7 @@ func TestJSON_Write_stdout(t *testing.T) { func TestJSON_WriteMultiplesTimesInSameFile(t *testing.T) { emptyAnalysis := &analyser.Analysis{} - longerAnalysis := fakeAnalysis() + longerAnalysis := fakeAnalysis(analyser.AnalyzerOptions{}) tempDir := t.TempDir() tempFile, err := ioutil.TempFile(tempDir, "result") if err != nil { diff --git a/pkg/cmd/scan/output/output_test.go b/pkg/cmd/scan/output/output_test.go index 1c1d296b..e92c178d 100644 --- a/pkg/cmd/scan/output/output_test.go +++ b/pkg/cmd/scan/output/output_test.go @@ -16,8 +16,8 @@ import ( "github.com/r3labs/diff/v2" ) -func fakeAnalysis() *analyser.Analysis { - a := analyser.Analysis{} +func fakeAnalysis(opts analyser.AnalyzerOptions) *analyser.Analysis { + a := analyser.NewAnalysis(opts) a.AddUnmanaged( &resource.Resource{ Id: "unmanaged-id-1", @@ -110,7 +110,7 @@ func fakeAnalysis() *analyser.Analysis { } func fakeAnalysisWithAlerts() *analyser.Analysis { - a := fakeAnalysis() + a := fakeAnalysis(analyser.AnalyzerOptions{}) a.SetAlerts(alerter.Alerts{ "": []alerter.Alert{ alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("dummy error"), "aws_vpc", "aws_vpc"), alerts.EnumerationPhase),