Fix mount_logs container startup on macOS Colima#24593
Conversation
On macOS the Docker daemon runs inside a VM. Colima, a common local setup, shares only the user's home directory by default, so the shared log file that mount_logs creates under $TMPDIR (/var/folders) is not visible to the daemon. Docker then materializes the missing bind source as an empty directory, which breaks any container that expects a file at that path (e.g. VoltDB's log4j appender crashes on startup). Anchor the shared-logs temp directory under $HOME on darwin, a location both Colima and Docker Desktop share. Linux is unchanged since the daemon is local there. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 240e83a | Docs | Datadog PR Page | Give us feedback! |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Validation ReportAll 21 validations passed. Show details
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 240e83ab24
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return os_type == 'windows' | ||
|
|
||
|
|
||
| def shared_logs_base_dir(): |
There was a problem hiding this comment.
Add a return type to the new helper
The repo-level /workspace/integrations-core/AGENTS.md says that new Python code must add type hinting, but this newly added helper is unannotated even though it returns either a path string or None. Please add an explicit return annotation such as str | None so the new code follows the documented convention.
Useful? React with 👍 / 👎.
What does this PR do?
Anchors the shared log files created by
mount_logs(indatadog_checks_dev'sdocker_run) under$HOMEon macOS instead of the default$TMPDIR(/var/folders).Motivation
On macOS the Docker daemon runs inside a VM. Colima, a common local Docker setup, shares only the user's home directory by default. The file that
shared_logscreates under$TMPDIRis therefore invisible to the daemon, so Docker materializes the missing bind-mount source as an empty directory. Any container expecting a file at that mount path then breaks.Concretely, this makes
ddev test <integration>fail for any integration that usesmount_logs=Trueon Colima. For VoltDB it manifests as thevoltdb0container crashing on startup: its log4jDailyRollingFileAppendertargets/var/log/voltdb.log(bind-mounted from${DD_LOG_1}), finds a directory instead of a file, and dies withjava.io.FileNotFoundException: /var/log/voltdb.log (Is a directory)followed by aNullPointerException. The environment fixture then exhausts its retries and every integration test errors during setup.$HOMEis shared by both Colima and Docker Desktop, so anchoring the shared-logs temp directory there fixes Colima without affecting Docker Desktop. Linux is unchanged (the daemon is local, so$TMPDIRis already daemon-visible), so CI behavior is unaffected.Validation:
ddev test datadog_checks_devlint clean;ddev test datadog_checks_dev -- -k docker-> 28 passed.ddev test voltdbon Colima ->voltdb0crashes with(Is a directory)NPE, all integration tests error at setup.TMPDIRoverride):voltdb0boots, no log4j crash, integration test passes (18s).Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged