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

fix: don't panic when logs waits for more than 5 seconds #1777

Closed
wants to merge 14 commits into from

Commits on Jun 8, 2023

  1. fix: synchronize consumer in tests

    The consumer's Accept method is running in a different gorutine than
    the main test.
    We need to synchronize access to the messages slice.
    
    Some tests waited for Ack before accessing Msgs and were properly
    synchronized.
    
    TestContainerLogWithErrClosed accessed Msgs while the consumer was
    running and the memory access was not synchronized.
    
    Test_StartStop did not wait for the expected lines to appear before
    stopping the log producer, there was nothing to guarantee that
    at least one line would be read.
    The test passed because currently the producer does not interrupt
    outstanding HTTP requests to fetch logs, so it implicitly waited for
    some logs to be received.
    We now wait for the mlem line to appear before stopping the log
    producer.
    martin-sucha committed Jun 8, 2023
    Configuration menu
    Copy the full SHA
    ada9d42 View commit details
    Browse the repository at this point in the history
  2. fix: don't panic when logs waits for more than 5 seconds

    This removes panic when logs endpoint takes more than 5 seconds to respond.
    The panic happened at least with podman when no new logs appear when using follow and since parameters.
    
    We keep retrying until the context is canceled
    (the retry request would fail anyway with canceled context)
    or the producer is stopped,
    whichever comes first.
    This makes the retry behavior consistent with closed connections
    handling.
    
    Outstanding HTTP calls for fetching logs are now interrupted when
    a producer is stopped.
    Previously the consumer and StopProducer() waited for the HTTP call
    to complete.
    
    This should fix testcontainers#946
    martin-sucha committed Jun 8, 2023
    Configuration menu
    Copy the full SHA
    075b0f3 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2023

  1. Configuration menu
    Copy the full SHA
    8b68f2a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0b6d915 View commit details
    Browse the repository at this point in the history
  3. Handle errors in log producer gracefully

    If the context is done, we close the log producer.
    That is not an error, the context cancellation signals that the consumer
    should stop.
    
    If there is a non-context error during the HTTP call or while reading
    the response, retry the HTTP request in 1 second again.
    
    Previously, the error handling was inconsistent:
    - an error while reading HTTP response headers would retry
      the HTTP request
    - but an error while reading the body would just end the log producer
    
    With this commit, the error handling should be more consistent.
    martin-sucha committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    bc8715e View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2023

  1. Merge branch 'main' into ms/issue-946-v2

    * main: (137 commits)
      Fix wrong module names (testcontainers#1776)
      docs: add default options to k6 module (testcontainers#1744)
      fix race condition in Test_StartStop (testcontainers#1700)
      chore(deps): bump github.com/aws/aws-sdk-go-v2/{service/s3,credentials,config} in /modules/localstack (testcontainers#1773)
      chore(deps): bump cloud.google.com/go/{datastore,bigtable,spanner} in /modules/gcloud (testcontainers#1774)
      chore(deps): bump golang.org/x/net from 0.15.0 to 0.17.0 (testcontainers#1772)
      docs: Fix typo and mention the relevant function name in doc (testcontainers#1745)
      DOCKER_HOST var typo (testcontainers#1743)
      feat: Add Cassandra module (testcontainers#1726)
      K6 module (testcontainers#1721)
      Rancher Desktop instructions (testcontainers#1724)
      chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.8 to 3.23.9 (testcontainers#1720)
      chore(deps): bump urllib3 from 2.0.5 to 2.0.6 (testcontainers#1718)
      chore(deps): bump github.com/twmb/franz-go/pkg/kadm in /modules/redpanda (testcontainers#1714)
      chore(deps): bump github.com/couchbase/gocb/v2 in /modules/couchbase (testcontainers#1704)
      chore(deps): bump github.com/neo4j/neo4j-go-driver/v5 in /modules/neo4j (testcontainers#1713)
      chore(deps): bump github.com/nats-io/nats.go in /modules/nats (testcontainers#1705)
      chore(deps): bump cloud.google.com/go/firestore from 1.12.0 to 1.13.0, google.golang.org/api from 0.142.0 to 0.143.0 and cloud.google.com/ge, google.golang.org/api from 0.142.0 to 0.143.0 and cloud.google.com/go/bigquery from 1.53.0 to 1.55 in /modules/gcloud (testcontainers#1716)
      chore(deps): bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.39.0 to 1.40.0 and github.com/aws/aws-sdk-go from 1.45.15 to 1.45.19 in /modules/localstack (testcontainers#1717)
      chore: prepare for next minor development cycle (0.26.0)
      ...
    mdelapenya committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    eab0920 View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2023

  1. Merge branch 'main' into ms/issue-946-v2

    * main:
      fix: data race in docker client `Info()` (testcontainers#1779)
      Use correct formatting directive for errors in lifecycle logs (testcontainers#1780)
      chore(deps): bump golang.org/x/mod from 0.12.0 to 0.13.0 in /modules/{elasticsearch,kafka} and /modulegen (testcontainers#1778)
      chore(deps): bump github.com/rabbitmq/amqp091-go in /modules/rabbitmq (testcontainers#1728)
      chore(deps): bump github.com/ClickHouse/clickhouse-go/v2 (testcontainers#1732)
      ignore patterns defined in dockerignore (testcontainers#1725)
    mdelapenya committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    57f6569 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1cdb8ce View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2023

  1. Configuration menu
    Copy the full SHA
    9e4b5a1 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2023

  1. Merge branch 'main' into ms/issue-946-v2

    * main:
      chore(deps): combine and bump compose dependencies (testcontainers#1787)
      feat: support for replacing images with custom substitutions (testcontainers#1719)
    mdelapenya committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    aec5067 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7453e4a View commit details
    Browse the repository at this point in the history
  3. chore: remove context cancelation checks, as the error comes from an …

    …operation that does not do anything with context
    mdelapenya committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    e143444 View commit details
    Browse the repository at this point in the history
  4. chore: remove context cancelation checks, as the error comes from an …

    …operation that does not do anything with context
    mdelapenya committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    8c9fbd3 View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2023

  1. chore: simplify print

    mdelapenya committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    51d6f8b View commit details
    Browse the repository at this point in the history