SShortSingh.
Back to feed

Docker Compose depends_on does not wait for database readiness, causing flaky tests

0
·1 views

A developer discovered that Docker Compose's depends_on directive in its short form only waits for a container to start, not for the service within it to become ready. This caused 11 out of 50 test runs to fail because the application attempted to connect to Postgres before it was accepting connections. The failure rate of 22% was especially problematic in fresh CI environments where database initialization takes longer. The article explains that the correct solution is to use the long form of depends_on with a healthcheck condition and to configure a specific TCP-based healthcheck command for Postgres.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

DEV Community Article Details Shipping Cutoff Rules for Warehouses

A DEV Community article presents a function designed to calculate whether same-day shipping is possible from a warehouse. The function checks local time against cutoffs, considers holidays, blackout carriers, weekends, and VIP service extensions. It is explicitly labeled as a teaching example, not code from a live production system. The article includes a table of twelve test cases to verify the function's behavior under different time zones and conditions.

0
ProgrammingDEV Community ·

WANDER App Uses Local AI to Generate Personalized Outdoor Missions

The WANDER app is an offline-first AI companion designed to encourage users to explore their surroundings. It uses Google's Gemma 3 4B model running locally via Ollama to generate three personalized outdoor missions based on user mood, available time, and weather. The app operates with a privacy-first approach, storing user journals and activity history locally on the device using SQLite. After selecting a mission, users are prompted to put their phones away and engage with their environment. The project was submitted for the Hacktoberfest Open-Source AI Challenge and is currently in early development stages.

0
ProgrammingDEV Community ·

Algorithm solves 'celebrity problem' efficiently with linear time

The celebrity problem asks to identify a person in a group whom everyone knows but who knows no one else. It is typically represented by an n x n matrix where entries indicate whether one person knows another. A naive brute-force solution requires O(n²) time to check all relationships. However, a more efficient algorithm can find a potential candidate in O(n) time using a single pass, then verify the candidate with a second pass. This optimized approach uses constant extra memory, improving on earlier stack-based linear-time methods.

Docker Compose depends_on does not wait for database readiness, causing flaky tests · ShortSingh