Skip to content

Commit

Permalink
ktlo(ddtrace,contrib): don't use hardcoded FS paths on integration/te…
Browse files Browse the repository at this point in the history
…lemetry tests (#3122)
  • Loading branch information
darccio authored Jan 28, 2025
1 parent ef2e4e2 commit 599da51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions contrib/internal/telemetrytest/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/json"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"

Expand Down Expand Up @@ -87,8 +88,9 @@ func TestTelemetryEnabled(t *testing.T) {
if strings.Contains(pkg.ImportPath, "/test") || strings.Contains(pkg.ImportPath, "/internal") || strings.Contains(pkg.ImportPath, "/cmd") {
continue
}
p := strings.Replace(pkg.Dir, pkg.Root, "../..", 1)
if strings.Contains(p, "/contrib/net/http/client") || strings.Contains(p, "/contrib/os") {
sep := string(os.PathSeparator)
p := strings.Replace(pkg.Dir, pkg.Root, filepath.Join("..", ".."), 1)
if strings.Contains(p, filepath.Join(sep, "contrib", "net", "http", "client")) || strings.Contains(p, filepath.Join(sep, "contrib", "os")) {
continue
}
if !pkg.hasTelemetryImport(t) {
Expand Down
5 changes: 3 additions & 2 deletions ddtrace/tracer/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,9 @@ func TestIntegrationEnabled(t *testing.T) {
if strings.Contains(pkg.ImportPath, "/test") || strings.Contains(pkg.ImportPath, "/internal") || strings.Contains(pkg.ImportPath, "/cmd") {
continue
}
p := strings.Replace(pkg.Dir, pkg.Root, "../..", 1)
if strings.Contains(p, "/contrib/net/http/client") || strings.Contains(p, "/contrib/os") {
sep := string(os.PathSeparator)
p := strings.Replace(pkg.Dir, pkg.Root, filepath.Join("..", ".."), 1)
if strings.Contains(p, filepath.Join(sep, "contrib", "net", "http", "client")) || strings.Contains(p, filepath.Join(sep, "contrib", "os")) {
continue
}
body, err := exec.Command("grep", "-rl", "MarkIntegrationImported", p).Output()
Expand Down

0 comments on commit 599da51

Please sign in to comment.