Skip to content

chore: improve error wrapping in some docker container methods and compose module#2720

Merged
mdelapenya merged 1 commit intotestcontainers:mainfrom
stevenh:chore/improve-error-wrapping
Aug 16, 2024
Merged

chore: improve error wrapping in some docker container methods and compose module#2720
mdelapenya merged 1 commit intotestcontainers:mainfrom
stevenh:chore/improve-error-wrapping

Conversation

@stevenh
Copy link
Copy Markdown
Contributor

@stevenh stevenh commented Aug 8, 2024

Improve error wrapping to help detect failures in compose and wait tests.

@stevenh stevenh requested a review from a team as a code owner August 8, 2024 19:04
@netlify
Copy link
Copy Markdown

netlify bot commented Aug 8, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit cd3cb56
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/66bceb449837ad000853c71b
😎 Deploy Preview https://deploy-preview-2720--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.

options_test.go Outdated
// but this is expected because we just want to test the log consumer
require.Error(t, err)
require.Contains(t, err.Error(), "container exited with code 1")
require.Contains(t, err.Error(), "start container: container exited with code 1")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
require.Contains(t, err.Error(), "start container: container exited with code 1")
require.Contains(t, err.Error(), "start container: started hook: wait until ready: container exited with code 1")

Copy link
Copy Markdown
Contributor Author

@stevenh stevenh Aug 14, 2024

Choose a reason for hiding this comment

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

This is using Contains so it only has to check for base error we're expecting. This specifically avoids checking any wrapping that might happen as that may change making the test fragile, it's essentially as close to errors.Is as we can get.

Improve error wrapping to help detect failures in compose and wait
tests.
Copy link
Copy Markdown
Member

@mdelapenya mdelapenya 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!

@mdelapenya mdelapenya self-assigned this Aug 16, 2024
@mdelapenya mdelapenya added the chore Changes that do not impact the existing functionality label Aug 16, 2024
@mdelapenya mdelapenya changed the title chore: improve error wrapping chore: improve error wrapping in some docker container methods and compose module Aug 16, 2024
@mdelapenya mdelapenya merged commit c8ec455 into testcontainers:main Aug 16, 2024
mdelapenya added a commit that referenced this pull request Aug 16, 2024
* main:
  fix: config via environment (#2725)
  fix(redpanda): race condition on port check (#2692)
  fix: logging restart (#2697)
  fix!: docker authentication setup (#2727)
  chore: improve error wrapping (#2720)
  chore: run make tests in verbose mode (#2734)
  chore(deps): bump github.com/docker/docker from 27.1.0+incompatible to 27.1.1+incompatible (#2733)
  fix(kafka): port race on start (#2696)
  docs: fix broken doc tags (#2732)
  fix: nginx request failures (#2723)
  fix(compose): container locking (#2722)
  fix(wait): log test timeout (#2716)
  chore: increase timeout values (#2719)
  chore: remove unused parameters (#2721)
  chore(mockserver): silence warning about internal port (#2730)
  feat(wait): skip internal host port check (#2691)
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.

2 participants