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

chore: use testify instead of t.Error #2871

Merged
merged 4 commits into from
Nov 3, 2024

Conversation

mmorel-35
Copy link
Contributor

What does this PR do?

This uses github.com/stretchr/testify instead of t.Error calls

Why is it important?

This reduce the number of lines required to make an assertion.
It also make the assertion easier to understand.

Related issues

@mmorel-35 mmorel-35 requested a review from a team as a code owner November 2, 2024 10:18
Copy link

netlify bot commented Nov 2, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 6b08eb8
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/67268759cc5b6a0008919f3a
😎 Deploy Preview https://deploy-preview-2871--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mmorel-35 mmorel-35 force-pushed the testifier/assert branch 2 times, most recently from d173e99 to 389504f Compare November 2, 2024 10:23
Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, we're standardising on require instead of assert to so we get just a single error at a time, for the reasons described in one of the examples.

docker_client_test.go Outdated Show resolved Hide resolved
docker_test.go Outdated Show resolved Hide resolved
@mmorel-35 mmorel-35 force-pushed the testifier/assert branch 2 times, most recently from 68176eb to 0232ccd Compare November 2, 2024 12:08
@mmorel-35 mmorel-35 requested a review from stevenh November 2, 2024 12:08
Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

As mentioned lets just standardise on require across the board to keep things simple.

docker_test.go Outdated Show resolved Hide resolved
@mmorel-35 mmorel-35 force-pushed the testifier/assert branch 2 times, most recently from c47c464 to 1f18f85 Compare November 2, 2024 12:49
@mmorel-35 mmorel-35 requested a review from stevenh November 2, 2024 13:09
Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

Thanks for your continued work on these improvements, most appreciated.

In the interest of keeping things simple lets just keep everything using require so have commented on each use of assert.

generic_test.go Outdated Show resolved Hide resolved
testcontainers_test.go Outdated Show resolved Hide resolved
testcontainers_test.go Outdated Show resolved Hide resolved
testcontainers_test.go Outdated Show resolved Hide resolved
testcontainers_test.go Outdated Show resolved Hide resolved
image_substitutors_test.go Outdated Show resolved Hide resolved
image_substitutors_test.go Outdated Show resolved Hide resolved
image_substitutors_test.go Outdated Show resolved Hide resolved
image_substitutors_test.go Outdated Show resolved Hide resolved
image_substitutors_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

Just one issue

provider_test.go Outdated Show resolved Hide resolved
provider_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the quick revisions!

@stevenh stevenh merged commit 19c1268 into testcontainers:main Nov 3, 2024
122 checks passed
@stevenh
Copy link
Collaborator

stevenh commented Nov 3, 2024

Thanks again for all your efforts on this @mmorel-35 most appreciated!

@mmorel-35 mmorel-35 deleted the testifier/assert branch November 3, 2024 10:19
@mdelapenya mdelapenya self-assigned this Nov 19, 2024
@mdelapenya mdelapenya added the chore Changes that do not impact the existing functionality label Nov 19, 2024
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Nov 19, 2024
* main: (34 commits)
  fix: only upload to sonar on ubuntu-latest (testcontainers#2891)
  fix: build artifact name properly (testcontainers#2890)
  fix: do not run sonar upload when ryuk is disabled (testcontainers#2889)
  fix: update GH actions for uploading/downloading artifacts (testcontainers#2888)
  feat(ci): Enable master moby with rootless (testcontainers#2880)
  fix(redpanda): temporary file use
  chore(deps): bump actions/download-artifact from 3.0.2 to 4.1.8 (testcontainers#2676)
  chore(deps): bump actions/upload-artifact from 3.1.3 to 4.4.3 (testcontainers#2885)
  fix!: port forwarding clean up and make private (testcontainers#2881)
  chore: resolve AWS deprecations for localstack (testcontainers#2879)
  docs: fix new lifecycle hooks section (testcontainers#2875)
  fix: host access port instability (testcontainers#2867)
  feat: add build to life cycle hooks (testcontainers#2653)
  fix: typo in containerd integration (testcontainers#2873)
  chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.2.2 (testcontainers#2806)
  chore: use testify instead of t.Error (testcontainers#2871)
  ci: enable perfsprint linter (testcontainers#2872)
  chore(deps): bump mkdocs-markdownextradata-plugin from 0.2.5 to 0.2.6 (testcontainers#2807)
  chore: use testcontainers.RequireContainerExec (testcontainers#2870)
  chore(deps): bump golangci/golangci-lint-action from 6.1.0 to 6.1.1 (testcontainers#2868)
  ...
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Nov 21, 2024
* main: (76 commits)
  fix(influxdb): Respect custom waitStrategy (testcontainers#2845)
  fix: only upload to sonar on ubuntu-latest (testcontainers#2891)
  fix: build artifact name properly (testcontainers#2890)
  fix: do not run sonar upload when ryuk is disabled (testcontainers#2889)
  fix: update GH actions for uploading/downloading artifacts (testcontainers#2888)
  feat(ci): Enable master moby with rootless (testcontainers#2880)
  fix(redpanda): temporary file use
  chore(deps): bump actions/download-artifact from 3.0.2 to 4.1.8 (testcontainers#2676)
  chore(deps): bump actions/upload-artifact from 3.1.3 to 4.4.3 (testcontainers#2885)
  fix!: port forwarding clean up and make private (testcontainers#2881)
  chore: resolve AWS deprecations for localstack (testcontainers#2879)
  docs: fix new lifecycle hooks section (testcontainers#2875)
  fix: host access port instability (testcontainers#2867)
  feat: add build to life cycle hooks (testcontainers#2653)
  fix: typo in containerd integration (testcontainers#2873)
  chore(deps): bump mkdocs-include-markdown-plugin from 6.0.4 to 6.2.2 (testcontainers#2806)
  chore: use testify instead of t.Error (testcontainers#2871)
  ci: enable perfsprint linter (testcontainers#2872)
  chore(deps): bump mkdocs-markdownextradata-plugin from 0.2.5 to 0.2.6 (testcontainers#2807)
  chore: use testcontainers.RequireContainerExec (testcontainers#2870)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Changes that do not impact the existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants