Skip to content

Commit

Permalink
internal/contrib/telemetrytest: fix url separators
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahkm committed Dec 19, 2024
1 parent a221b46 commit 1257d9f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions internal/contrib/telemetrytest/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ func (p *contribPkg) hasInstrumentationImport() bool {

// TestTelemetryEnabled verifies that the expected contrib packages leverage instrumentation telemetry
func TestTelemetryEnabled(t *testing.T) {
p := fmt.Sprintf("..%c..%c..%ccontrib", os.PathSeparator, os.PathSeparator, os.PathSeparator)
root, err := filepath.Abs(p)
root, err := filepath.Abs(filepath.Join("..", "..", "..", "contrib"))
if err != nil {
t.Fatal(err)
}
Expand All @@ -62,7 +61,6 @@ func testTelemetryEnabled(t *testing.T, contribPath string) error {
t.Helper()
t.Log(contribPath)
pwd, err := os.Getwd()
separator := fmt.Sprintf("%c", os.PathSeparator)
if err != nil {
return err
}
Expand All @@ -72,7 +70,7 @@ func testTelemetryEnabled(t *testing.T, contribPath string) error {
if err = os.Chdir(contribPath); err != nil {
return err
}
body, err := exec.Command("go", "list", "-json", "."+separator+"...").Output()
body, err := exec.Command("go", "list", "-json", "./...").Output()
if err != nil {
t.Log(string(body))
return err
Expand All @@ -88,7 +86,7 @@ func testTelemetryEnabled(t *testing.T, contribPath string) error {
packages = append(packages, out)
}
for _, pkg := range packages {
if strings.Contains(pkg.ImportPath, separator+"test") || strings.Contains(pkg.ImportPath, separator+"internal") {
if strings.Contains(pkg.ImportPath, "/test") || strings.Contains(pkg.ImportPath, "/internal") {
continue
}
if !pkg.hasInstrumentationImport() {
Expand Down

0 comments on commit 1257d9f

Please sign in to comment.