Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test improvements #206

Merged
merged 5 commits into from
Nov 3, 2024
Merged

Unit test improvements #206

merged 5 commits into from
Nov 3, 2024

Conversation

NathanBaulch
Copy link
Contributor

@NathanBaulch NathanBaulch commented Oct 17, 2024

A couple of improvements to make failing unit tests a little easier to diagnose.

@c2fo-cibot c2fo-cibot bot added the size/XL Denotes a PR that changes 500-999 lines label Oct 17, 2024
@NathanBaulch NathanBaulch force-pushed the tests branch 3 times, most recently from fb3fcb6 to 54cef4e Compare October 21, 2024 06:28
@c2fo-cibot c2fo-cibot bot added size/XXL Denotes a PR that changes 1000+ lines and removed size/XL Denotes a PR that changes 500-999 lines labels Oct 21, 2024
fileList, err := loc.ListByPrefix(test.prefix)
lt.NoError(err, test.description)
lt.Equal(test.expectedFiles, fileList, test.description)
lt.Run(test.description, func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it... makes for easier runing for table-driven tests.

if err != nil {
ts.Fail("Shouldn't return error creating test s3.File instance.")
}
ts.Require().NoError(err, "Shouldn't return error creating test s3.File instance.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much clearer construct

Copy link
Member

@funkyshu funkyshu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually only one change needed, update the CHANGELOG.md, under ## [Unreleased] with summary of your changes, adhering to https://keepachangelog.com/en/1.1.0/ semantics.

For instance:

## [Unreleased]

### Fixed
- Unit Test improvements: report underlying unit tests errors, always run test cases in sub-test, always use test suite functions, use more specific assert functions where possible.

When a release is created we'll update the section for the release.

@funkyshu funkyshu self-requested a review November 3, 2024 15:16
@funkyshu funkyshu merged commit 4c42b46 into C2FO:main Nov 3, 2024
6 checks passed
@NathanBaulch NathanBaulch deleted the tests branch November 3, 2024 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL Denotes a PR that changes 1000+ lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants