Use testify in tests
What does this MR do?
This MR changes all comparison logic in tests to use testify
-
Change error checking:
Instead of:
if err != nil { t.Fatal(err) }Use:
require.NoError(t, err) -
Change equality checks:
Instead of:
if !reflect.DeepEqual(got, tc.want) { t.Errorf("Wrong result. Expected %#v but got %#v", tc.want, got) }Use:
require.Equal(t, tc.want, got)
Why use require instead of assert?
By using require, the tests will fail immediately, whereas using assert will allow subsequent statements to be executed, which is confusing
What are the relevant issue numbers?
gitlab-org/gitlab#230600 (closed)
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 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
Edited by Lucas Charles