1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-10-30 23:57:50 +02:00

Fix checkmarx execute scan (#2747)

* Fixes infinite recursion

Signed-off-by: Fabian Reh <fabian.reh@sap.com>

* Adds test for infinite recursion

Signed-off-by: Fabian Reh <fabian.reh@sap.com>
This commit is contained in:
Fabian Reh
2021-04-08 09:16:47 +02:00
committed by GitHub
parent bb62252600
commit 9f55c4360d
2 changed files with 11 additions and 1 deletions

View File

@@ -43,7 +43,7 @@ func (checkmarxExecuteScanUtilsBundle) PathMatch(pattern, name string) (bool, er
}
func (b checkmarxExecuteScanUtilsBundle) GetWorkspace() string {
return b.GetWorkspace()
return b.workspace
}
func (checkmarxExecuteScanUtilsBundle) WriteFile(filename string, data []byte, perm os.FileMode) error {

View File

@@ -954,3 +954,13 @@ func TestLoadPreset(t *testing.T) {
assert.Equal(t, 0, preset.ID, "Expected result but got none")
})
}
func TestPreventInfiniteLoop(t *testing.T) {
t.Parallel()
utils := checkmarxExecuteScanUtilsBundle{
workspace: "abc",
}
assert.Equal(t, "abc", utils.GetWorkspace(), "Wrong workspace has been loaded")
}