Skip to content

Commit

Permalink
Merge branch '8.x' into mergify/bp/8.x/pr-5889
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersonQ authored Nov 6, 2024
2 parents 0c5328f + bc14c62 commit bb0da61
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 17 deletions.
12 changes: 6 additions & 6 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1264,11 +1264,11 @@ SOFTWARE

--------------------------------------------------------------------------------
Dependency : github.com/elastic/elastic-agent-libs
Version: v0.14.0
Version: v0.17.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.14.0/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-libs@v0.17.0/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -2766,11 +2766,11 @@ limitations under the License.

--------------------------------------------------------------------------------
Dependency : github.com/elastic/opentelemetry-collector-components/connector/signaltometricsconnector
Version: v0.2.1
Version: v0.3.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/opentelemetry-collector-components/connector/signaltometricsconnector@v0.2.1/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/opentelemetry-collector-components/connector/signaltometricsconnector@v0.3.0/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -52357,11 +52357,11 @@ Contents of probable licence file $GOMODCACHE/github.com/open-telemetry/opentele

--------------------------------------------------------------------------------
Dependency : github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling
Version: v0.111.0
Version: v0.112.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling@v0.111.0/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling@v0.112.0/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ require (
github.com/dolmen-go/contextio v0.0.0-20200217195037-68fc5150bcd5
github.com/elastic/elastic-agent-autodiscover v0.9.0
github.com/elastic/elastic-agent-client/v7 v7.16.0
github.com/elastic/elastic-agent-libs v0.14.0
github.com/elastic/elastic-agent-libs v0.17.0
github.com/elastic/elastic-agent-system-metrics v0.11.3
github.com/elastic/elastic-transport-go/v8 v8.6.0
github.com/elastic/go-elasticsearch/v8 v8.15.0
github.com/elastic/go-licenser v0.4.2
github.com/elastic/go-sysinfo v1.15.0
github.com/elastic/go-ucfg v0.8.8
github.com/elastic/mock-es v0.0.0-20240712014503-e5b47ece0015
github.com/elastic/opentelemetry-collector-components/connector/signaltometricsconnector v0.2.1
github.com/elastic/opentelemetry-collector-components/connector/signaltometricsconnector v0.3.0
github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor v0.13.0
github.com/elastic/opentelemetry-collector-components/processor/elastictraceprocessor v0.2.1
github.com/elastic/opentelemetry-collector-components/processor/lsmintervalprocessor v0.2.0
Expand Down Expand Up @@ -334,7 +334,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata v0.112.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.112.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.112.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.111.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.112.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.112.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.112.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.112.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ github.com/elastic/elastic-agent-autodiscover v0.9.0 h1:+iWIKh0u3e8I+CJa3FfWe9h0
github.com/elastic/elastic-agent-autodiscover v0.9.0/go.mod h1:5iUxLHhVdaGSWYTveSwfJEY4RqPXTG13LPiFoxcpFd4=
github.com/elastic/elastic-agent-client/v7 v7.16.0 h1:yKGq2+CxAuW8Kh0EoNl202tqAyQKfBcPRawVKs2Jve0=
github.com/elastic/elastic-agent-client/v7 v7.16.0/go.mod h1:6h+f9QdIr3GO2ODC0Y8+aEXRwzbA5W4eV4dd/67z7nI=
github.com/elastic/elastic-agent-libs v0.14.0 h1:a2kCeIBMeJ8U5UIIMB8JyW2C8J7ocK7qerYYH89r7Hw=
github.com/elastic/elastic-agent-libs v0.14.0/go.mod h1:5CR02awPrBr+tfmjBBK+JI+dMmHNQjpVY24J0wjbC7M=
github.com/elastic/elastic-agent-libs v0.17.0 h1:KvgigcnlH74yZGZyKx7tqn9zBzy6Bt+AVhg3PfrxNW0=
github.com/elastic/elastic-agent-libs v0.17.0/go.mod h1:5CR02awPrBr+tfmjBBK+JI+dMmHNQjpVY24J0wjbC7M=
github.com/elastic/elastic-agent-system-metrics v0.11.3 h1:LDzRwP8kxvsYEtMDgMSKZs1TgPcSEukit+/EAP5Y28A=
github.com/elastic/elastic-agent-system-metrics v0.11.3/go.mod h1:saqLKe9fuyuAo6IADAnnuy1kaBI7VNlxfwMo8KzSRyQ=
github.com/elastic/elastic-transport-go/v8 v8.6.0 h1:Y2S/FBjx1LlCv5m6pWAF2kDJAHoSjSRSJCApolgfthA=
Expand Down Expand Up @@ -294,8 +294,8 @@ github.com/elastic/lunes v0.1.0 h1:amRtLPjwkWtzDF/RKzcEPMvSsSseLDLW+bnhfNSLRe4=
github.com/elastic/lunes v0.1.0/go.mod h1:xGphYIt3XdZRtyWosHQTErsQTd4OP1p9wsbVoHelrd4=
github.com/elastic/mock-es v0.0.0-20240712014503-e5b47ece0015 h1:z8cC8GASpPo8yKlbnXI36HQ/BM9wYjhBPNbDjAWm0VU=
github.com/elastic/mock-es v0.0.0-20240712014503-e5b47ece0015/go.mod h1:qH9DX/Dmflz6EAtaks/+2SsdQzecVAKE174Zl66hk7E=
github.com/elastic/opentelemetry-collector-components/connector/signaltometricsconnector v0.2.1 h1:OLpob3qEleqQnlgnBRJyClWr63TVThJd5s06CFnzKFI=
github.com/elastic/opentelemetry-collector-components/connector/signaltometricsconnector v0.2.1/go.mod h1:zIiDkPObWcSOpOzD3iWkaGawMs97oYLFA6i0T5Uv1EI=
github.com/elastic/opentelemetry-collector-components/connector/signaltometricsconnector v0.3.0 h1:5bEQRB73ZYYdZ1cRntygO8uAPajWLZCs1FOqWfq8JYg=
github.com/elastic/opentelemetry-collector-components/connector/signaltometricsconnector v0.3.0/go.mod h1:6HKwtIQ7G+Vjotgnh18dpaD0YqSi87Zbsu21w5dxxXE=
github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor v0.13.0 h1:Y8DWrxdpNMscYXTN3EoK509vqf+0aD1RfNZF5wOtsQs=
github.com/elastic/opentelemetry-collector-components/processor/elasticinframetricsprocessor v0.13.0/go.mod h1:iLTitn5RdFtBHYLC2YVAgjv2OxCKY51rdhtrsT1hQ8I=
github.com/elastic/opentelemetry-collector-components/processor/elastictraceprocessor v0.2.1 h1:7cCOF19TJPivDc/QjV0VxU1ySwDib6TS2WJ9TP3iEpk=
Expand Down Expand Up @@ -890,8 +890,8 @@ github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.112.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.112.0/go.mod h1:W9HkQWHB/Zc6adYHDG3FNyxfERt9eBAw2sBqNYBBBEE=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.112.0 h1:8PY5CY+G2iSos1slLDUPk+S4NE3UTNF78rPInN8pDOA=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.112.0/go.mod h1:56AlkVJK6UUzDIg5NBqNCPDM6Jsyr2pqK4Tvrt+25ms=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.111.0 h1:7DqvnAOXIPv6PEKA347VXACc07E1utEWcjuxsY4YOXA=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.111.0/go.mod h1:6hlplIB2LiSciMabYB5IpwrBn3Hl/P8JakNm0uNkVug=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.112.0 h1:nBU6V0fVLhtcc3ARizEraVILm8kAMtuj0p0SRPMm86A=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.112.0/go.mod h1:WgPsi5PjWkdwDoYgEerEgVegHfiKPwUlR8QoxKBCwFU=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.112.0 h1:HFFYes5Ah4FPgxfPm93ewqAJQ2/iID2R+xHFJj2rjRo=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza v0.112.0/go.mod h1:luOW5UHNBCGMyjIWMyhEZ3ASnyu3oB2MwfvqnRyjcIk=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.112.0 h1:hwv61wlyTdz5kTbP/rw/ID56OdOjM2Ixp8voEoLJkBk=
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/otel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ This section provides a summary of components included in the Elastic Distributi

| Component | Version |
|---|---|
| [signaltometricsconnector](https://github.com/elastic/opentelemetry-collector-components/blob/connector/signaltometricsconnector/v0.2.1/connector/signaltometricsconnector/README.md) | v0.2.1 |
| [signaltometricsconnector](https://github.com/elastic/opentelemetry-collector-components/blob/connector/signaltometricsconnector/v0.3.0/connector/signaltometricsconnector/README.md) | v0.3.0 |
| [spanmetricsconnector](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/connector/spanmetricsconnector/v0.112.0/connector/spanmetricsconnector/README.md) | v0.112.0 |
17 changes: 17 additions & 0 deletions pkg/testing/define/define.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"path/filepath"
"regexp"
"runtime"
"slices"
"strings"
"sync"
"testing"
Expand Down Expand Up @@ -143,6 +144,17 @@ func runOrSkip(t *testing.T, req Requirements, local bool, kubernetes bool) *Inf
if err := req.Validate(); err != nil {
panic(fmt.Sprintf("test %s has invalid requirements: %s", t.Name(), err))
}

filteredGroups := GroupsFilter.values
if len(filteredGroups) > 0 && !slices.Contains(filteredGroups, req.Group) {
t.Skipf("group %s not found in groups filter %s. Skipping", req.Group, filteredGroups)
return nil
}

if SudoFilter.value != nil && req.Sudo != *SudoFilter.value {
t.Skipf("sudo requirement %t not matching sudo filter %t. Skipping", req.Sudo, *SudoFilter.value)
}

if !req.Local && local {
t.Skip("running local only tests and this test doesn't support local")
return nil
Expand Down Expand Up @@ -173,6 +185,11 @@ func runOrSkip(t *testing.T, req Requirements, local bool, kubernetes bool) *Inf
t.Skipf("platform: %s, architecture: %s, version: %s, and distro: %s combination is not supported by test. required: %v", runtime.GOOS, runtime.GOARCH, osInfo.Version, osInfo.Platform, req.OS)
return nil
}

if DryRun {
return dryRun(t, req)
}

namespace, err := getNamespace(t, local)
if err != nil {
panic(err)
Expand Down
75 changes: 75 additions & 0 deletions pkg/testing/define/define_flags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License 2.0;
// you may not use this file except in compliance with the Elastic License 2.0.

package define

import (
"flag"
"fmt"
"strconv"
"strings"
"testing"
)

type optionalBoolFlag struct {
value *bool
}

func (o *optionalBoolFlag) String() string {
if o.value == nil {
return "nil"
}
return strconv.FormatBool(*o.value)
}

func (o *optionalBoolFlag) Set(s string) error {
bValue := s == "" || s == "true"
o.value = &bValue
return nil
}

type stringArrayFlag struct {
values []string
}

func (s *stringArrayFlag) String() string {
return fmt.Sprintf("%s", s.values)
}

func (s *stringArrayFlag) Set(stringValue string) error {
if stringValue == "" {
return nil
}
s.values = strings.Split(stringValue, ",")
return nil
}

var (
DryRun bool
GroupsFilter stringArrayFlag
PlatformsFilter stringArrayFlag
SudoFilter optionalBoolFlag
)

func RegisterFlags(prefix string, set *flag.FlagSet) {
set.BoolVar(&DryRun, prefix+"dry-run", false, "Forces test in dry-run mode: skips the main test and puts a successful placeholder <TestName>/dry-run if the test would have run")
set.Var(&GroupsFilter, prefix+"groups", "test groups, comma-separated")
set.Var(&PlatformsFilter, prefix+"platforms", "test platforms, comma-separated")
set.Var(&SudoFilter, prefix+"sudo", "Filter tests by sudo requirements")
}

func dryRun(t *testing.T, req Requirements) *Info {
// always validate requirement is valid
if err := req.Validate(); err != nil {
t.Logf("test %s has invalid requirements: %s", t.Name(), err)
t.FailNow()
return nil
}
// skip the test as we are in dry run
t.Run("dry-run", func(t *testing.T) {
t.Log("Test dry-run successful")
})
t.Skip("Skipped because dry-run mode has been specified.")
return nil
}
2 changes: 1 addition & 1 deletion pkg/testing/define/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func ValidateDir(dir string) error {
for _, file := range pkg.Files {
for _, d := range file.Decls {
fn, ok := d.(*ast.FuncDecl)
if ok && strings.HasPrefix(fn.Name.Name, "Test") && fn.Recv == nil {
if ok && fn.Name.Name != "TestMain" && strings.HasPrefix(fn.Name.Name, "Test") && fn.Recv == nil {
if !validateRequireFromFunc(fn) {
return fmt.Errorf("test %s first statement must be a function call to define.Require", fn.Name.Name)
}
Expand Down
32 changes: 32 additions & 0 deletions testing/integration/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License 2.0;
// you may not use this file except in compliance with the Elastic License 2.0.

package integration

import (
"flag"
"log"
"os"
"testing"

"github.com/elastic/elastic-agent/pkg/testing/define"
)

var flagSet = flag.CommandLine

func init() {
define.RegisterFlags("integration.", flagSet)
}

func TestMain(m *testing.M) {
flag.Parse()
runExitCode := m.Run()

if define.DryRun {
// TODO add parsing of requirements and dump them
log.Print("Dry-run mode specified...")
}

os.Exit(runExitCode)
}

0 comments on commit bb0da61

Please sign in to comment.