testcontainers / testcontainers/testcontainers-java

Using a postgres image with mounted `/data` fails on LogWaitStrategy

Đang mở
#3,372 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

modules/postgres resolution/acknowledged type/bug
Ngôn ngữ chính
Java
Star
8.7k
Fork
1.9k
Merge trung bình
2 ngày 17 giờ
Pull request đã merge (30 ngày)
9

Mô tả

Testcontainer:
version: 1.14.3

Postgres:
version: 5.6-alpine
output:

PostgreSQL Database directory appears to contain a database; Skipping initialization

LOG:  database system was interrupted; last known up at 2020-10-13 08:45:54 UTC
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  redo starts at 0/14F0430
LOG:  invalid record length at 0/3356CD0: wanted 24, got 0
LOG:  redo done at 0/3356CA8
LOG:  last completed transaction was at log time 2020-10-13 08:46:42.609873+00
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

Expected behavior:

  • Container started successfully

Exception:

org.testcontainers.containers.ContainerLaunchException: Timed out waiting for log output matching '.*database system is ready to accept connections.*\s'
	at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:31)

Issue:
Because the image skep the initialization and the code on PostgresSQLContainer:56 is registering the LogMessageWaitStrategy to match the line ".*database system is ready to accept connections.*\\s" twice withTimes(2), the container readiness check fails.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu tại modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java, ở phần đăng ký wait-strategy được tham chiếu, sau đó đọc LogMessageWaitStrategy.waitUntilReady. Tái hiện trường hợp này với một container PostgreSQL sử dụng thư mục /data được mount và xác minh rằng quá trình khởi động hoàn tất mà không gặp readiness timeout.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
docker, java, postgresql
Lĩnh vực
databases, testing
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.