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

Add toxiproxy example #643

Merged
merged 1 commit into from Nov 26, 2022
Merged

Add toxiproxy example #643

merged 1 commit into from Nov 26, 2022

Conversation

eddumelendez
Copy link
Member

What does this PR do?

Demostrate how to use toxiproxy along with testcontainers-go. A proxy is created in order to inject faults to between redis client and redis container.

redis-client -> toxiproxy's proxy -> redis

  • Port 8474 is toxiproxy's port
  • Port 8666 is a random port for the proxy
  • Proxy is created, where 0.0.0.0:8666 will route to redis:6379
  • Redis' client will use toxiproxy' proxy, it means :
  • Read timeout is alter to 2s (default 3s) so the example doesn't take that long when the latency injected is higher. Currently, latency injected is between 900-1100

Why is it important?

First step for upcoming modules.

Related issues

Latency can be updated to 3000 ms and then the test will break. In order to fix it the readTimeout should be updated too.

@eddumelendez eddumelendez requested a review from a team as a code owner November 26, 2022 04:39
Copy link
Collaborator

@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.

Fantastic example!

I would not require assertions on how the toxics are added to the requests, as we trust the toxiproxi works as expected.

Super nice contribution!!

@mdelapenya mdelapenya merged commit c45303b into main Nov 26, 2022
@mdelapenya mdelapenya deleted the toxiproxy_example branch November 26, 2022 10:16
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Nov 29, 2022
* main:
  Add toxiproxy example (testcontainers#643)
  Add spanner example (testcontainers#642)
  chore: sync governance files (testcontainers#641)
  Add pubsub example (testcontainers#640)
  chore: adjust generator for the docs site (testcontainers#639)
  Add datastore example (testcontainers#638)
  Add firestore example (testcontainers#637)
  fix: avoid panics when checking container state and container.raw is nil (testcontainers#635)
  feat: provide a tool to generate examples from code (#618)
  chore: bump version in mkdocs (#630)
  docs: remove code snippets from main README (testcontainers#631)
  docs: document replace directive for Docker Compose (testcontainers#632)
@mdelapenya mdelapenya added the documentation Docs, docs, docs. label Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Docs, docs, docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants