Ensure tests are passing locally and on CI
What does this MR do?
When running go test ./...
locally I noticed the tests were failing, but this was not the case when the same code was run on CI.
This issue is caused by GITLAB_FEATURES
not including the value sast_fp_reduction
on a development machine. On CI GITLAB_FEATURES
is set to include all the possible features, so when TransformToGLSASTReport
is called, the primary identifiers are included.
The MR updates the unit test to explicitly set t.Setenv("GITLAB_FEATURES", "sast_fp_reduction")
so that testing locally and testing on CI provide the same result.
Note: This is only a temporary fix. To fix permanently the TestConvert
should be refactored only to make assertions to the parts of the report the Convert
function changes. Making this small change however will prevent any other developer spending time debugging the test failing locally.
What are the relevant issue numbers?
KICS unit tests fail locally but pass on CI (gitlab-org/gitlab#473694 - closed) • Craig Smith • 17.3
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated for GitLab EE, if necessary -
Documentation created/updated for this project, if necessary -
Documentation reviewed by technical writer or follow-up review issue created -
Tests updated/added for this feature/bug -
Job definition updated, if necessary -
Conforms to the code review guidelines -
Conforms to the Go guidelines -
Security reports checked/validated by reviewer