testcontainers / testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
https://testcontainers-python.readthedocs.io/en/latest/
Apache License 2.0
1.59k stars 290 forks source link

Bug: PostgresContainer waits forever when using tensorchord/pgvecto-rs:pg16-v0.3.0 #703

Closed theS1LV3R closed 1 month ago

theS1LV3R commented 1 month ago

Describe the bug Whenever PostgresContainer is ran using tensorchord/pgvecto-rs:pg16-v0.3.0, it waits forever for postgres to be ready. This happens because pgvecto.rs added -c logging_collector=on to their Dockerfile CMD. This puts all logs after "PostgreSQL init process complete; ready for start up." to a separate file instead of to stdout, which is what PostgresContainer is expecting: https://github.com/testcontainers/testcontainers-python/blob/8f1165dd79ee0dcf16f37f2d186cbc3d47bc11bc/modules/postgres/testcontainers/postgres/__init__.py#L117-L124

To Reproduce

https://github.com/theS1LV3R/testcontainers-pgvecto-rs-test

Runtime environment
# Get the operating system information (on a unix os).
$ uname -a
Linux oxygen 6.10.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 12 Sep 2024 17:21:02 +0000 x86_64 GNU/Linux
$ python --version
Python 3.12.6
$ docker info
Client:
 Version:    27.2.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.17.1
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.29.3
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 6
  Running: 6
  Paused: 0
  Stopped: 0
 Images: 73
 Server Version: 27.2.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.10.10-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 24
 Total Memory: 61.95GiB
 Name: oxygen
 ID: 946f81c2-45fa-43a8-ba53-d0808af674c4
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 10.245.0.0/16, Size: 24
   Base: fd00:beef:245::/64, Size: 64
$ pip freeze
# See requirements.txt in referenced repository above
alexanderankin commented 1 month ago

yep sounds like a legitimate issue, seems like the same fix for the #695 would do the trick

sskorol commented 4 weeks ago

I've built the wheel from the main branch, and it works as expected.

theS1LV3R commented 4 weeks ago

Can confirm the latest version (4.8.2) fixed my issue, thanks a lot!