Skip to content

Commit aceb9c8

Browse files
[9.2] (backport #11025) Update OTel dependencies to 0.139.0/v1.45.0 and Elastic ones to v0.20.0/v0.21.0 (#11311)
sed -i 's/\(go\.opentelemetry\.io\/collector.*\) v1\.43\.0/\1 v1.45.0/' go.mod sed -i 's/\(go\.opentelemetry\.io\/collector.*\) v0\.137.0/\1 v0.139.0/' go.mod sed -i 's/\(github\.com\/open-telemetry\/opentelemetry\-collector\-contrib\/.*\) v0\.137\.0/\1 v0.139.0/' go.mod go get -u github.com/elastic/opentelemetry-collector-components/... (cherry picked from commit ad43a0d) # Conflicts: # NOTICE-fips.txt # NOTICE.txt # go.mod # go.sum # internal/edot/go.mod # internal/edot/go.sum # internal/pkg/otel/README.md --------- Co-authored-by: Tiago Queiroz <[email protected]>
1 parent e71001c commit aceb9c8

File tree

13 files changed

+4065
-5512
lines changed

13 files changed

+4065
-5512
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ fleet.yml.old
6363
pkg/component/fake/component/component
6464
internal/pkg/agent/install/testblocking/testblocking
6565
internal/pkg/otel/manager/testing/testing
66+
pkg/core/process/testsignal/testsignal

NOTICE-fips.txt

Lines changed: 1165 additions & 2041 deletions
Large diffs are not rendered by default.

NOTICE.txt

Lines changed: 900 additions & 1535 deletions
Large diffs are not rendered by default.

go.mod

Lines changed: 283 additions & 286 deletions
Large diffs are not rendered by default.

go.sum

Lines changed: 604 additions & 614 deletions
Large diffs are not rendered by default.

internal/edot/go.mod

Lines changed: 280 additions & 285 deletions
Large diffs are not rendered by default.

internal/edot/go.sum

Lines changed: 602 additions & 613 deletions
Large diffs are not rendered by default.

internal/pkg/otel/README.md

Lines changed: 63 additions & 63 deletions
Large diffs are not rendered by default.

magefile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2258,7 +2258,7 @@ func (Integration) Local(ctx context.Context, testName string) error {
22582258
// run the integration tests but only run test that can run locally
22592259
params := devtools.DefaultGoTestIntegrationArgs()
22602260
params.Tags = append(params.Tags, "local")
2261-
params.Packages = []string{"github.com/elastic/elastic-agent/testing/integration"}
2261+
params.Packages = []string{"github.com/elastic/elastic-agent/testing/integration/..."}
22622262

22632263
var goTestFlags []string
22642264
rawTestFlags := os.Getenv("GOTEST_FLAGS")

pkg/testing/fs.go

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
2+
// or more contributor license agreements. Licensed under the Elastic License 2.0;
3+
// you may not use this file except in compliance with the Elastic License 2.0.
4+
5+
package testing
6+
7+
import (
8+
"os"
9+
"path/filepath"
10+
"runtime"
11+
"strings"
12+
"testing"
13+
"unicode"
14+
"unicode/utf8"
15+
)
16+
17+
// TempDir creates a temporary directory that will be
18+
// removed if the tests passes. The temporary directory is
19+
// created by joining all elements from path, with the sanitised
20+
// test name.
21+
//
22+
// If path is empty, the temporary directory is created in os.TempDir.
23+
//
24+
// When tests are run with -v, the temporary directory absolute
25+
// path will be logged.
26+
func TempDir(t *testing.T, path ...string) string {
27+
rootDir := filepath.Join(path...)
28+
29+
if rootDir == "" {
30+
rootDir = os.TempDir()
31+
}
32+
33+
rootDir, err := filepath.Abs(rootDir)
34+
if err != nil {
35+
t.Fatalf("cannot get absolute path: %s", err)
36+
}
37+
38+
// Logic copied with small modifications from
39+
// the Go source code: testing/testing.go
40+
folderName := t.Name()
41+
mapper := func(r rune) rune {
42+
if r < utf8.RuneSelf {
43+
const allowed = "_-"
44+
if '0' <= r && r <= '9' ||
45+
'a' <= r && r <= 'z' ||
46+
'A' <= r && r <= 'Z' {
47+
return r
48+
}
49+
if strings.ContainsRune(allowed, r) {
50+
return r
51+
}
52+
} else if unicode.IsLetter(r) || unicode.IsNumber(r) {
53+
return r
54+
}
55+
return -1
56+
}
57+
folderName = strings.Map(mapper, folderName)
58+
59+
if err := os.MkdirAll(rootDir, 0o750); err != nil {
60+
t.Fatalf("error making test dir: %s: %s", rootDir, err)
61+
}
62+
63+
tempDir, err := os.MkdirTemp(rootDir, folderName)
64+
if err != nil {
65+
t.Fatalf("failed to make temp directory: %s", err)
66+
}
67+
68+
cleanup := func() {
69+
if !t.Failed() {
70+
if err := os.RemoveAll(tempDir); err != nil {
71+
// Ungly workaround Windows limitations
72+
// Windows does not support the Interrup signal, so it might
73+
// happen that Filebeat is still running, keeping it's registry
74+
// file open, thus preventing the temporary folder from being
75+
// removed. So we log the error and move on without failing the
76+
// test
77+
if runtime.GOOS == "windows" {
78+
t.Logf("[WARN] Could not remove temporatry directory '%s': %s", tempDir, err)
79+
} else {
80+
t.Errorf("could not remove temp dir '%s': %s", tempDir, err)
81+
}
82+
}
83+
} else {
84+
t.Logf("Temporary directory saved: %s", tempDir)
85+
}
86+
}
87+
t.Cleanup(cleanup)
88+
89+
return tempDir
90+
}

0 commit comments

Comments
 (0)