From 632b4f47fcbfa823aeabda0cc975ba9db523c935 Mon Sep 17 00:00:00 2001 From: shirim Date: Mon, 23 Sep 2024 11:50:23 +0300 Subject: [PATCH 01/11] added test of non-consistent html public internet nodes --- iks_config_object.html | 21606 +++++++++++++++++++++++++++ pkg/ibmvpc/analysis_output_test.go | 14 +- 2 files changed, 21618 insertions(+), 2 deletions(-) create mode 100644 iks_config_object.html diff --git a/iks_config_object.html b/iks_config_object.html new file mode 100644 index 000000000..cdc544313 --- /dev/null +++ b/iks_config_object.html @@ -0,0 +1,21606 @@ + + + + + + + + + + VPC Connectivity Diagram + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +


Public Network

+
+ +
+ + + + + + + + + + + + + + + + + + + +


IBM Cloud

+
+ +
+ + + + + + + + + + + + + + + + + + + +


+
+ +
+ + + + + + + + + + + + + + + + + + + +


ky-test-vpc

+
+ +
+ + + + + + + + + + + + + + + + + + + +


us-south-3

+
+ +
+ + + + + + + + + + + + + + + + + + + +


us-south-2

+
+ +
+ + + + + + + + + + + + + + + + + + + +


us-south-1

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-transit-subnet-1
192.168.16.0/22
ky-test-edge-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-transit-subnet-3
192.168.24.0/22
ky-test-edge-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-private-subnet-1
192.168.0.0/22
ky-test-private-2-others-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-edge-subnet-1
192.168.32.0/22
ky-test-edge-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-transit-subnet-2
192.168.20.0/22
ky-test-edge-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-nlb-subnet-3
192.168.56.0/22
ky-test-edge-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-private-subnet-2
192.168.4.0/22
ky-test-private-2-others-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-private-subnet-3
192.168.8.0/22
ky-test-private-2-others-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-edge-subnet-2
192.168.36.0/22
ky-test-edge-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-nlb-subnet-1
192.168.48.0/22
ky-test-edge-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-edge-subnet-3
192.168.40.0/22
ky-test-edge-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + +

ky-test-nlb-subnet-2
192.168.52.0/22
ky-test-edge-acl

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +


kube-r006-d7cfb31a-1d4b-40c8-83df-ce2e6f8f2e57

+
+ +
+ + + + + + + + + + + + + + + + + + + +

kube-clusterid:1
ky-test-default-sg

+
+ +
+ + + + + + + + + + + + + + + + + + + +


kube-r006-d7cfb31a-1d4b-40c8-83df-ce2e6f8f2e57

+
+ +
+ + + + + + + + + + + + + + + + + + + +


kube-r006-d7cfb31a-1d4b-40c8-83df-ce2e6f8f2e57

+
+ +
+ + + + + + + + + + + + + + + + + + + +

kube-clusterid:1
ky-test-default-sg

+
+ +
+ + + + + + + + + + + + + + + + + + + +

kube-clusterid:1
ky-test-default-sg

+
+ +
+ + + + + + + + + + + + + + + + + + + +

kube-clusterid:1
ky-test-default-sg

+
+ +
+ + + + + + + + + + + + + + + + + + + +

kube-clusterid:1
ky-test-default-sg

+
+ +
+ + + + + + + + + + + + + + + + + + + +

kube-clusterid:1
ky-test-default-sg

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +

ky-test-gateway-1

+
+ + + +
+ + + + + + + + + + + + + +

iks-node[192.168.32.4]

+
+ + + +
+ + + + + + + + + + + + + +

iks-clusterid:1[192.168.36.5]

+
+ + + +
+ + + + + + + + + + + + + +

iks-node[192.168.8.4]

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +

iks-node[192.168.20.4]

+
+ + + +
+ + + + + + + + + + + + + +

iks-node[192.168.16.4]

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +

ky-test-gateway-2

+
+ + + +
+ + + + + + + + + + + + + +

Public Internet

+
+ + + +
+ + + + + + + + + + + + + +

iks-clusterid:1[192.168.40.5]

+
+ + + +
+ + + + + + + + + + + + + +

iks-node[192.168.0.4]

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +

iks-node[192.168.36.4]

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +

iks-node[192.168.4.4]

+
+ + + +
+ + + + + + + + + + + + + +

kube-clusterid:1-8fdd1d0a2ce34deba99d0f885451b1ca

+
+ + + +
+ + + + + + + + + + + + + +

iks-node[192.168.40.4]

+
+ + + +
+ + + + + + + + + + + + + +

iks-clusterid:1[192.168.32.5]

+
+ + + +
+ + + + + + + + + + + + + +

iks-clusterid:1

+
+ + + +
+ + + + + + + + + + + + + +

iks-node[192.168.24.4]

+
+ + + +
+ + + + + + + + + + + + + +

ky-test-gateway-3

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP ** + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + TCP,... + protocol: TCP,UDP dst-ports: 30000-32767 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TCP,UDP + protocol: TCP,UDP + + + + + + + + + + + + + + + + + + + + +
+ + + +Text is not SVG - cannot display + + + + +
+
+
Please select the SOURCE node
+ + + + diff --git a/pkg/ibmvpc/analysis_output_test.go b/pkg/ibmvpc/analysis_output_test.go index 77118e0ec..fe632975c 100644 --- a/pkg/ibmvpc/analysis_output_test.go +++ b/pkg/ibmvpc/analysis_output_test.go @@ -26,6 +26,16 @@ tests for the entire flow: const analysisOut = "analysis_out" var tests = []*commonvpc.VpcGeneralTest{ + { + InputConfig: "iks_config_object", + UseCases: []vpcmodel.OutputUseCase{vpcmodel.AllEndpoints}, + Grouping: true, + Format: vpcmodel.HTML, + NoLbAbstract: true, + }, +} + +var tests1 = []*commonvpc.VpcGeneralTest{ { InputConfig: "acl_testing5", UseCases: []vpcmodel.OutputUseCase{vpcmodel.AllSubnets}, @@ -601,7 +611,7 @@ var tests = []*commonvpc.VpcGeneralTest{ } // uncomment the function below to run for updating the expected output -/* + func TestAllWithGeneration(t *testing.T) { // tests is the list of tests to run for testIdx := range tests { @@ -610,7 +620,7 @@ func TestAllWithGeneration(t *testing.T) { } fmt.Println("done") } -*/ + func TestAllWithComparison(t *testing.T) { // tests is the list of tests to run for testIdx := range tests { From aafc6b3e142c667148543cbac7a132837c763a38 Mon Sep 17 00:00:00 2001 From: shirim Date: Mon, 23 Sep 2024 11:52:07 +0300 Subject: [PATCH 02/11] comment uncommented by mistake --- pkg/ibmvpc/analysis_output_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/ibmvpc/analysis_output_test.go b/pkg/ibmvpc/analysis_output_test.go index fe632975c..1acf02129 100644 --- a/pkg/ibmvpc/analysis_output_test.go +++ b/pkg/ibmvpc/analysis_output_test.go @@ -611,7 +611,7 @@ var tests1 = []*commonvpc.VpcGeneralTest{ } // uncomment the function below to run for updating the expected output - +/* func TestAllWithGeneration(t *testing.T) { // tests is the list of tests to run for testIdx := range tests { @@ -620,7 +620,7 @@ func TestAllWithGeneration(t *testing.T) { } fmt.Println("done") } - +*/ func TestAllWithComparison(t *testing.T) { // tests is the list of tests to run for testIdx := range tests { From caa5231dbc52a93cc20eec7d3cb104fe05938811 Mon Sep 17 00:00:00 2001 From: shirim Date: Wed, 25 Sep 2024 11:48:10 +0300 Subject: [PATCH 03/11] separation to computation and printing --- cmd/analyzer/subcmds/lint.go | 2 +- .../analysis_output_test_functionality.go | 2 +- pkg/linter/linterExecute.go | 36 +++++++++++++------ pkg/linter/linterTypes.go | 2 ++ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/cmd/analyzer/subcmds/lint.go b/cmd/analyzer/subcmds/lint.go index bf6dee78b..100dbd189 100644 --- a/cmd/analyzer/subcmds/lint.go +++ b/cmd/analyzer/subcmds/lint.go @@ -52,7 +52,7 @@ func lintVPCConfigs(cmd *cobra.Command, args *inArgs) error { return err1 } // potential errors already handled - _, _, err2 := linter.LinterExecute(multiConfigs.Configs(), args.printAllLinters, + _, _, err2 := linter.LinterExecuteOld(multiConfigs.Configs(), args.printAllLinters, args.enableLinters, args.disableLinters) return err2 } diff --git a/pkg/commonvpc/analysis_output_test_functionality.go b/pkg/commonvpc/analysis_output_test_functionality.go index f4dd3af4e..d5c357dba 100644 --- a/pkg/commonvpc/analysis_output_test_functionality.go +++ b/pkg/commonvpc/analysis_output_test_functionality.go @@ -456,7 +456,7 @@ func runLintTestPerUseCase(t *testing.T, outDir string) error { // output use case is not significant here, but being used so that lint test can rely on existing mechanism initLintTestFileNames(tt, outDir) - _, actualOutput, _ := linter.LinterExecute(cConfigs, tt.PrintAllLints, tt.Enable, tt.Disable) + _, actualOutput, _ := linter.LinterExecuteOld(cConfigs, tt.PrintAllLints, tt.Enable, tt.Disable) if err := CompareOrRegenerateOutputPerTest(t, tt.Mode, actualOutput, lintOut, tt, vpcmodel.AllEndpoints); err != nil { return err } diff --git a/pkg/linter/linterExecute.go b/pkg/linter/linterExecute.go index 39c5aed9d..f099e5774 100644 --- a/pkg/linter/linterExecute.go +++ b/pkg/linter/linterExecute.go @@ -43,7 +43,7 @@ func IsValidLintersNames(name string) bool { _, ok := linterGenerators[name] return ok } -func generateLinters(configs map[string]*vpcmodel.VPCConfig, nodeConn map[string]*vpcmodel.VPCConnectivity) []linter { +func generateLinters(configs map[string]*vpcmodel.VPCConfig, nodeConn map[string]*vpcmodel.VPCConnectivity) Linters { res := make([]linter, len(linterGenerators)) i := 0 for name, generator := range linterGenerators { @@ -66,16 +66,26 @@ func computeConnectivity(configs map[string]*vpcmodel.VPCConfig) (map[string]*vp } // ////////////////////////////////////////////////////////////////////////////////////////////// -// LinterExecute executes linters one by one -func LinterExecute(configs map[string]*vpcmodel.VPCConfig, printAllFindings bool, +// LinterExecuteOld executes linters one by one +func LinterExecuteOld(configs map[string]*vpcmodel.VPCConfig, printAllFindings bool, enableList, disableList []string) (issueFound bool, resString string, err error) { - nodesConn, err := computeConnectivity(configs) + linters, err := LinterExecute(configs, enableList, disableList) if err != nil { return false, "", err } + resString = linters.String(printAllFindings) + fmt.Println(resString) + return issueFound, resString, nil +} - linters := generateLinters(configs, nodesConn) - strPerLint := []string{} +// LinterExecute executes linters one by one and collects their results +func LinterExecute(configs map[string]*vpcmodel.VPCConfig, enableList, disableList []string) (linters Linters, err error) { + nodesConn, err := computeConnectivity(configs) + if err != nil { + return nil, err + } + + linters = generateLinters(configs, nodesConn) for _, thisLinter := range linters { name := thisLinter.lintName() enable := thisLinter.enableByDefault() @@ -84,14 +94,20 @@ func LinterExecute(configs map[string]*vpcmodel.VPCConfig, printAllFindings bool if !enable { continue } - thisLintStr := "" err := thisLinter.check() if err != nil { - return false, "", err + return nil, err } + } + return linters, nil +} + +func (linters Linters) String(printAllFindings bool) (resString string) { + strPerLint := []string{} + for _, thisLinter := range linters { + thisLintStr := "" lintFindings := thisLinter.getFindings() if len(lintFindings) > 0 { - issueFound = true thisLintStr = thisLinter.string(thisLinter.lintDescription(), printAllFindings) strPerLint = append(strPerLint, thisLintStr) } @@ -100,5 +116,5 @@ func LinterExecute(configs map[string]*vpcmodel.VPCConfig, printAllFindings bool delimBetweenLints := strings.Repeat("_", delimBetweenLintsChars) resString = strings.Join(strPerLint, "\n"+delimBetweenLints+"\n\n") fmt.Println(resString) - return issueFound, resString, nil + return resString } diff --git a/pkg/linter/linterTypes.go b/pkg/linter/linterTypes.go index 65c9882de..73aa540b8 100644 --- a/pkg/linter/linterTypes.go +++ b/pkg/linter/linterTypes.go @@ -16,6 +16,8 @@ import ( const numFindingToPrint = 3 +type Linters []linter + type linter interface { check() error getFindings() []finding // returns all findings detected by the linter From 5df677f7c19dd1f5b94dd3483024f00afa36fd53 Mon Sep 17 00:00:00 2001 From: shirim Date: Wed, 25 Sep 2024 12:17:01 +0300 Subject: [PATCH 04/11] undo committed by mistake --- pkg/ibmvpc/analysis_output_test.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pkg/ibmvpc/analysis_output_test.go b/pkg/ibmvpc/analysis_output_test.go index 1acf02129..77118e0ec 100644 --- a/pkg/ibmvpc/analysis_output_test.go +++ b/pkg/ibmvpc/analysis_output_test.go @@ -26,16 +26,6 @@ tests for the entire flow: const analysisOut = "analysis_out" var tests = []*commonvpc.VpcGeneralTest{ - { - InputConfig: "iks_config_object", - UseCases: []vpcmodel.OutputUseCase{vpcmodel.AllEndpoints}, - Grouping: true, - Format: vpcmodel.HTML, - NoLbAbstract: true, - }, -} - -var tests1 = []*commonvpc.VpcGeneralTest{ { InputConfig: "acl_testing5", UseCases: []vpcmodel.OutputUseCase{vpcmodel.AllSubnets}, From a7e989a584b12b8fcd9f9b6c06ab0cca124d813d Mon Sep 17 00:00:00 2001 From: shirim Date: Wed, 25 Sep 2024 12:23:43 +0300 Subject: [PATCH 05/11] merge with main --- pkg/commonvpc/testfunc/lint_test_functionality.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/commonvpc/testfunc/lint_test_functionality.go b/pkg/commonvpc/testfunc/lint_test_functionality.go index df2e1159a..35d75d18f 100644 --- a/pkg/commonvpc/testfunc/lint_test_functionality.go +++ b/pkg/commonvpc/testfunc/lint_test_functionality.go @@ -54,7 +54,7 @@ func (tt *VpcLintTest) TestSingleLint(t *testing.T, rc commonvpc.ResourcesContai func (tt *VpcLintTest) runLintTest(t *testing.T, cConfigs map[string]*vpcmodel.VPCConfig, outDir string) error { // output use case is not significant here, but being used so that lint test can rely on existing mechanism tt.initLintTestFileNames(outDir) - _, actualOutput, _ := linter.LinterExecute(cConfigs, tt.PrintAllLints, tt.Enable, tt.Disable) + _, actualOutput, _ := linter.LinterExecuteOld(cConfigs, tt.PrintAllLints, tt.Enable, tt.Disable) if err := compareOrRegenerateOutputPerTest(t, tt.Mode, actualOutput, lintOut, tt.Name, tt.ExpectedOutput, vpcmodel.AllEndpoints); err != nil { return err From 9f21050c5a6764ebe40d0e2be51a0f6d65bdca64 Mon Sep 17 00:00:00 2001 From: shirim Date: Wed, 25 Sep 2024 15:35:11 +0300 Subject: [PATCH 06/11] renaming towards a midterm PR --- cmd/analyzer/subcmds/lint.go | 2 +- pkg/commonvpc/testfunc/lint_test_functionality.go | 2 +- pkg/linter/linterExecute.go | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/analyzer/subcmds/lint.go b/cmd/analyzer/subcmds/lint.go index 100dbd189..bf6dee78b 100644 --- a/cmd/analyzer/subcmds/lint.go +++ b/cmd/analyzer/subcmds/lint.go @@ -52,7 +52,7 @@ func lintVPCConfigs(cmd *cobra.Command, args *inArgs) error { return err1 } // potential errors already handled - _, _, err2 := linter.LinterExecuteOld(multiConfigs.Configs(), args.printAllLinters, + _, _, err2 := linter.LinterExecute(multiConfigs.Configs(), args.printAllLinters, args.enableLinters, args.disableLinters) return err2 } diff --git a/pkg/commonvpc/testfunc/lint_test_functionality.go b/pkg/commonvpc/testfunc/lint_test_functionality.go index 35d75d18f..df2e1159a 100644 --- a/pkg/commonvpc/testfunc/lint_test_functionality.go +++ b/pkg/commonvpc/testfunc/lint_test_functionality.go @@ -54,7 +54,7 @@ func (tt *VpcLintTest) TestSingleLint(t *testing.T, rc commonvpc.ResourcesContai func (tt *VpcLintTest) runLintTest(t *testing.T, cConfigs map[string]*vpcmodel.VPCConfig, outDir string) error { // output use case is not significant here, but being used so that lint test can rely on existing mechanism tt.initLintTestFileNames(outDir) - _, actualOutput, _ := linter.LinterExecuteOld(cConfigs, tt.PrintAllLints, tt.Enable, tt.Disable) + _, actualOutput, _ := linter.LinterExecute(cConfigs, tt.PrintAllLints, tt.Enable, tt.Disable) if err := compareOrRegenerateOutputPerTest(t, tt.Mode, actualOutput, lintOut, tt.Name, tt.ExpectedOutput, vpcmodel.AllEndpoints); err != nil { return err diff --git a/pkg/linter/linterExecute.go b/pkg/linter/linterExecute.go index 5bbe0e860..8fb2f0a0c 100644 --- a/pkg/linter/linterExecute.go +++ b/pkg/linter/linterExecute.go @@ -66,10 +66,10 @@ func computeConnectivity(configs map[string]*vpcmodel.VPCConfig) (map[string]*vp } // ////////////////////////////////////////////////////////////////////////////////////////////// -// LinterExecuteOld executes linters one by one -func LinterExecuteOld(configs map[string]*vpcmodel.VPCConfig, printAllFindings bool, +// LinterExecute executes linters one by one +func LinterExecute(configs map[string]*vpcmodel.VPCConfig, printAllFindings bool, enableList, disableList []string) (issueFound bool, resString string, err error) { - linters, err := LinterExecute(configs, enableList, disableList) + linters, err := linterAnalysis(configs, enableList, disableList) if err != nil { return false, "", err } @@ -78,8 +78,8 @@ func LinterExecuteOld(configs map[string]*vpcmodel.VPCConfig, printAllFindings b return issueFound, resString, nil } -// LinterExecute executes linters one by one and collects their results -func LinterExecute(configs map[string]*vpcmodel.VPCConfig, enableList, disableList []string) (linters Linters, err error) { +// linterAnalysis executes linters one by one and collects their results +func linterAnalysis(configs map[string]*vpcmodel.VPCConfig, enableList, disableList []string) (linters Linters, err error) { nodesConn, err := computeConnectivity(configs) if err != nil { return nil, err From f511aa4aed621b5f8a977ef3ba19a19c539148c1 Mon Sep 17 00:00:00 2001 From: shirim Date: Wed, 25 Sep 2024 15:42:58 +0300 Subject: [PATCH 07/11] removed redundant file --- iks_config_object.html | 21606 --------------------------------------- 1 file changed, 21606 deletions(-) delete mode 100644 iks_config_object.html diff --git a/iks_config_object.html b/iks_config_object.html deleted file mode 100644 index cdc544313..000000000 --- a/iks_config_object.html +++ /dev/null @@ -1,21606 +0,0 @@ - - - - - - - - - - VPC Connectivity Diagram - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Public Network

-
- -
- - - - - - - - - - - - - - - - - - - -


IBM Cloud

-
- -
- - - - - - - - - - - - - - - - - - - -


-
- -
- - - - - - - - - - - - - - - - - - - -


ky-test-vpc

-
- -
- - - - - - - - - - - - - - - - - - - -


us-south-3

-
- -
- - - - - - - - - - - - - - - - - - - -


us-south-2

-
- -
- - - - - - - - - - - - - - - - - - - -


us-south-1

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-transit-subnet-1
192.168.16.0/22
ky-test-edge-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-transit-subnet-3
192.168.24.0/22
ky-test-edge-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-private-subnet-1
192.168.0.0/22
ky-test-private-2-others-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-edge-subnet-1
192.168.32.0/22
ky-test-edge-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-transit-subnet-2
192.168.20.0/22
ky-test-edge-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-nlb-subnet-3
192.168.56.0/22
ky-test-edge-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-private-subnet-2
192.168.4.0/22
ky-test-private-2-others-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-private-subnet-3
192.168.8.0/22
ky-test-private-2-others-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-edge-subnet-2
192.168.36.0/22
ky-test-edge-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-nlb-subnet-1
192.168.48.0/22
ky-test-edge-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-edge-subnet-3
192.168.40.0/22
ky-test-edge-acl

-
- -
- - - - - - - - - - - - - - - - - - - -

ky-test-nlb-subnet-2
192.168.52.0/22
ky-test-edge-acl

-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


kube-r006-d7cfb31a-1d4b-40c8-83df-ce2e6f8f2e57

-
- -
- - - - - - - - - - - - - - - - - - - -

kube-clusterid:1
ky-test-default-sg

-
- -
- - - - - - - - - - - - - - - - - - - -


kube-r006-d7cfb31a-1d4b-40c8-83df-ce2e6f8f2e57

-
- -
- - - - - - - - - - - - - - - - - - - -


kube-r006-d7cfb31a-1d4b-40c8-83df-ce2e6f8f2e57

-
- -
- - - - - - - - - - - - - - - - - - - -

kube-clusterid:1
ky-test-default-sg

-
- -
- - - - - - - - - - - - - - - - - - - -

kube-clusterid:1
ky-test-default-sg

-
- -
- - - - - - - - - - - - - - - - - - - -

kube-clusterid:1
ky-test-default-sg

-
- -
- - - - - - - - - - - - - - - - - - - -

kube-clusterid:1
ky-test-default-sg

-
- -
- - - - - - - - - - - - - - - - - - - -

kube-clusterid:1
ky-test-default-sg

-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -

ky-test-gateway-1

-
- - - -
- - - - - - - - - - - - - -

iks-node[192.168.32.4]

-
- - - -
- - - - - - - - - - - - - -

iks-clusterid:1[192.168.36.5]

-
- - - -
- - - - - - - - - - - - - -

iks-node[192.168.8.4]

-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -

iks-node[192.168.20.4]

-
- - - -
- - - - - - - - - - - - - -

iks-node[192.168.16.4]

-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -

ky-test-gateway-2

-
- - - -
- - - - - - - - - - - - - -

Public Internet

-
- - - -
- - - - - - - - - - - - - -

iks-clusterid:1[192.168.40.5]

-
- - - -
- - - - - - - - - - - - - -

iks-node[192.168.0.4]

-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -

iks-node[192.168.36.4]

-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -

iks-node[192.168.4.4]

-
- - - -
- - - - - - - - - - - - - -

kube-clusterid:1-8fdd1d0a2ce34deba99d0f885451b1ca

-
- - - -
- - - - - - - - - - - - - -

iks-node[192.168.40.4]

-
- - - -
- - - - - - - - - - - - - -

iks-clusterid:1[192.168.32.5]

-
- - - -
- - - - - - - - - - - - - -

iks-clusterid:1

-
- - - -
- - - - - - - - - - - - - -

iks-node[192.168.24.4]

-
- - - -
- - - - - - - - - - - - - -

ky-test-gateway-3

-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP ** - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - TCP,... - protocol: TCP,UDP dst-ports: 30000-32767 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TCP,UDP - protocol: TCP,UDP - - - - - - - - - - - - - - - - - - - - -
- - - -Text is not SVG - cannot display - - - - -
-
-
Please select the SOURCE node
- - - - From 499b5d78bc8ae9d3ad78a2697f2495e6181529a7 Mon Sep 17 00:00:00 2001 From: shirim Date: Wed, 25 Sep 2024 15:47:58 +0300 Subject: [PATCH 08/11] fix comment --- pkg/linter/linterExecute.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/linter/linterExecute.go b/pkg/linter/linterExecute.go index 8fb2f0a0c..a76cb3a10 100644 --- a/pkg/linter/linterExecute.go +++ b/pkg/linter/linterExecute.go @@ -65,8 +65,8 @@ func computeConnectivity(configs map[string]*vpcmodel.VPCConfig) (map[string]*vp return nodesConn, nil } -// ////////////////////////////////////////////////////////////////////////////////////////////// -// LinterExecute executes linters one by one +// LinterExecute performs the lint analysis and then prints the string result; should be redundant once lint is +// integrated in the general flow func LinterExecute(configs map[string]*vpcmodel.VPCConfig, printAllFindings bool, enableList, disableList []string) (issueFound bool, resString string, err error) { linters, err := linterAnalysis(configs, enableList, disableList) From b48a2952682b488ba52b13167b788314f7334bbf Mon Sep 17 00:00:00 2001 From: shirim Date: Thu, 26 Sep 2024 09:52:39 +0300 Subject: [PATCH 09/11] CR --- pkg/linter/linterExecute.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/linter/linterExecute.go b/pkg/linter/linterExecute.go index a76cb3a10..e1d1721ae 100644 --- a/pkg/linter/linterExecute.go +++ b/pkg/linter/linterExecute.go @@ -105,10 +105,9 @@ func linterAnalysis(configs map[string]*vpcmodel.VPCConfig, enableList, disableL func (linters Linters) String(printAllFindings bool) (resString string) { strPerLint := []string{} for _, thisLinter := range linters { - thisLintStr := "" lintFindings := thisLinter.getFindings() if len(lintFindings) > 0 { - thisLintStr = thisLinter.string(thisLinter.lintDescription(), printAllFindings) + thisLintStr := thisLinter.string(thisLinter.lintDescription(), printAllFindings) strPerLint = append(strPerLint, thisLintStr) } } From 6a1d4336afa04da63b3b992f5a7156fa5b85caa5 Mon Sep 17 00:00:00 2001 From: shirim Date: Thu, 26 Sep 2024 09:57:01 +0300 Subject: [PATCH 10/11] CR remove redundant line --- pkg/linter/linterExecute.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/linter/linterExecute.go b/pkg/linter/linterExecute.go index e1d1721ae..9f1bbcc3c 100644 --- a/pkg/linter/linterExecute.go +++ b/pkg/linter/linterExecute.go @@ -114,6 +114,5 @@ func (linters Linters) String(printAllFindings bool) (resString string) { sort.Strings(strPerLint) delimBetweenLints := strings.Repeat("_", delimBetweenLintsChars) resString = strings.Join(strPerLint, "\n"+delimBetweenLints+"\n\n") - fmt.Println(resString) return resString } From 8f2c80aa864e05584fa7795f72056918de395020 Mon Sep 17 00:00:00 2001 From: shirim Date: Thu, 26 Sep 2024 10:01:45 +0300 Subject: [PATCH 11/11] CR remove redundant parm --- cmd/analyzer/subcmds/lint.go | 2 +- pkg/commonvpc/testfunc/lint_test_functionality.go | 2 +- pkg/linter/linterExecute.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/analyzer/subcmds/lint.go b/cmd/analyzer/subcmds/lint.go index bf6dee78b..7ab26d2c6 100644 --- a/cmd/analyzer/subcmds/lint.go +++ b/cmd/analyzer/subcmds/lint.go @@ -52,7 +52,7 @@ func lintVPCConfigs(cmd *cobra.Command, args *inArgs) error { return err1 } // potential errors already handled - _, _, err2 := linter.LinterExecute(multiConfigs.Configs(), args.printAllLinters, + _, err2 := linter.LinterExecute(multiConfigs.Configs(), args.printAllLinters, args.enableLinters, args.disableLinters) return err2 } diff --git a/pkg/commonvpc/testfunc/lint_test_functionality.go b/pkg/commonvpc/testfunc/lint_test_functionality.go index df2e1159a..674e6e32a 100644 --- a/pkg/commonvpc/testfunc/lint_test_functionality.go +++ b/pkg/commonvpc/testfunc/lint_test_functionality.go @@ -54,7 +54,7 @@ func (tt *VpcLintTest) TestSingleLint(t *testing.T, rc commonvpc.ResourcesContai func (tt *VpcLintTest) runLintTest(t *testing.T, cConfigs map[string]*vpcmodel.VPCConfig, outDir string) error { // output use case is not significant here, but being used so that lint test can rely on existing mechanism tt.initLintTestFileNames(outDir) - _, actualOutput, _ := linter.LinterExecute(cConfigs, tt.PrintAllLints, tt.Enable, tt.Disable) + actualOutput, _ := linter.LinterExecute(cConfigs, tt.PrintAllLints, tt.Enable, tt.Disable) if err := compareOrRegenerateOutputPerTest(t, tt.Mode, actualOutput, lintOut, tt.Name, tt.ExpectedOutput, vpcmodel.AllEndpoints); err != nil { return err diff --git a/pkg/linter/linterExecute.go b/pkg/linter/linterExecute.go index 9f1bbcc3c..78a7d5ae4 100644 --- a/pkg/linter/linterExecute.go +++ b/pkg/linter/linterExecute.go @@ -68,14 +68,14 @@ func computeConnectivity(configs map[string]*vpcmodel.VPCConfig) (map[string]*vp // LinterExecute performs the lint analysis and then prints the string result; should be redundant once lint is // integrated in the general flow func LinterExecute(configs map[string]*vpcmodel.VPCConfig, printAllFindings bool, - enableList, disableList []string) (issueFound bool, resString string, err error) { + enableList, disableList []string) (resString string, err error) { linters, err := linterAnalysis(configs, enableList, disableList) if err != nil { - return false, "", err + return "", err } resString = linters.String(printAllFindings) fmt.Println(resString) - return issueFound, resString, nil + return resString, nil } // linterAnalysis executes linters one by one and collects their results