Skip to content

Ensure tests are passing locally and on CI

Craig Smith requested to merge craigmsmith-fix-dev-env-failing-specs into main

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?

Edited by Craig Smith

Merge request reports

Loading