WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@dd-octo-sts
Copy link
Contributor

@dd-octo-sts dd-octo-sts bot commented Dec 5, 2025

Backport 320050a from #43627.


What does this PR do?

The present change is expected to reduce test execution time, especially with race detection enabled, and hopefully prevent timeouts in TestTraces and siblings.

This change implements the TODO in agent.go by:

  • creating a top-level temporary directory,
  • building trace-agent and secret-script binaries once in that directory, with GOPRIVATE=* and GOPROXY=off to prevent concurrent module cache access,
  • creating symlinks to the cached binaries in per-test subdirectories,
  • cleaning up the entire temp directory tree after all tests complete.

Motivation

The trace-agent integration tests have been repeatedly failing on timeouts, for instance:

There are at least 2 culprits:

  1. rebuilding the trace-agent binary from scratch for every test run. When running with the race detector (-race flag), each build takes time,
  2. module cache contention when building, see tests_macos_gitlab_amd64: tentatively fix flaky TestAll #43207 for why.

### What does this PR do?
The present change is expected to reduce test execution time, especially with race detection enabled, and hopefully prevent timeouts in `TestTraces` and siblings.

This change implements the `TODO` in `agent.go` by:
- creating a top-level temporary directory,
- building `trace-agent` and `secret-script` binaries once in that directory, with `GOPRIVATE=*` and `GOPROXY=off` to prevent concurrent module cache access,
- creating symlinks to the cached binaries in per-test subdirectories,
- cleaning up the entire temp directory tree after all tests complete.

### Motivation
The `trace-agent` integration tests have been repeatedly failing on timeouts, for instance:
- https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/1261246921
- https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/1261237699
- https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/1261226844

There are at least 2 culprits:
1. rebuilding the `trace-agent` binary from scratch for every test run. When running with the race detector (`-race` flag), each build takes time,
2. module cache contention when building, see #43207 for why.

Co-authored-by: regis.desgroppes <[email protected]>
(cherry picked from commit 320050a)
@dd-octo-sts dd-octo-sts bot requested a review from a team as a code owner December 5, 2025 14:35
@dd-octo-sts dd-octo-sts bot added changelog/no-changelog qa/no-code-change No code change in Agent code requiring validation backport bot short review PR is simple enough to be reviewed quickly ask-review Ask required teams to review this PR labels Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ask-review Ask required teams to review this PR backport bot changelog/no-changelog qa/no-code-change No code change in Agent code requiring validation short review PR is simple enough to be reviewed quickly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants