Skip to content

Commit

Permalink
[chore] fix distribution test ; ensure namedpipereceiver is in the di…
Browse files Browse the repository at this point in the history
…stribution (open-telemetry#30384)

**Description:**
Fix the distribution test that checks that components of stability alpha
or above are in otelcontribcol.
Add the namedpipereceiver component to otelcontribcol as part of this
fix.
  • Loading branch information
atoulme authored Jan 18, 2024
1 parent 9521409 commit bcc7163
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
2 changes: 2 additions & 0 deletions cmd/otelcontribcol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ receivers:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbatlasreceiver v0.92.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbreceiver v0.92.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mysqlreceiver v0.92.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/namedpipereceiver v0.92.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nginxreceiver v0.92.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver v0.92.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.92.0
Expand Down Expand Up @@ -450,3 +451,4 @@ replaces:
- github.com/open-telemetry/opentelemetry-collector-contrib/extension/opampextension => ../../extension/opampextension
- github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatasenders/mockdatadogagentexporter => ../../testbed/mockdatasenders/mockdatadogagentexporter
- github.com/open-telemetry/opentelemetry-collector-contrib/testbed => ../../testbed
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/namedpipereceiver => ../../receiver/namedpipereceiver
2 changes: 2 additions & 0 deletions cmd/otelcontribcol/components.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 16 additions & 11 deletions cmd/otelcontribcol/distribution_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,30 @@ func TestComponentsArePresent(t *testing.T) {
tt.Skip("no status present, skipping", metadataComponent)
return
}
inDevelopment := true
deprecated := true
inDevelopment := len(m.Status.Stability) == 0
deprecated := false
inUse := false
for stability, pipelines := range m.Status.Stability {
if stability != "development" && len(pipelines) > 0 {
inDevelopment = false
break
}
if stability != "deprecated" && len(pipelines) > 0 {
deprecated = false
break
if len(pipelines) > 0 {
switch stability {
case "development":
inDevelopment = true
case "deprecated":
deprecated = true
case "unmaintained":
// consider not in use.
default: // alpha, beta, stable
inUse = true
}
}
}

if inDevelopment {
if inDevelopment && !inUse {
tt.Skip("component in development, skipping", metadataComponent)
return
}

if deprecated {
if deprecated && !inUse {
tt.Skip("component deprecated, skipping", metadataComponent)
return
}
Expand Down
3 changes: 3 additions & 0 deletions cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbatlasreceiver v0.92.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbreceiver v0.92.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mysqlreceiver v0.92.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/namedpipereceiver v0.92.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nginxreceiver v0.92.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver v0.92.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.92.0
Expand Down Expand Up @@ -1191,3 +1192,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/opam
replace github.com/open-telemetry/opentelemetry-collector-contrib/testbed/mockdatasenders/mockdatadogagentexporter => ../../testbed/mockdatasenders/mockdatadogagentexporter

replace github.com/open-telemetry/opentelemetry-collector-contrib/testbed => ../../testbed

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/namedpipereceiver => ../../receiver/namedpipereceiver
11 changes: 11 additions & 0 deletions cmd/otelcontribcol/receivers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver/receivertest"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/namedpipereceiver"

tcpop "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/input/tcp"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscloudwatchreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureblobreceiver"
Expand Down Expand Up @@ -460,6 +462,15 @@ func TestDefaultReceivers(t *testing.T) {
receiver: "solace",
skipLifecycle: true, // Requires a solace broker to connect to
},
{
receiver: "namedpipe",
skipLifecycle: runtime.GOOS != "linux",
getConfigFn: func() component.Config {
cfg := rcvrFactories["namedpipe"].CreateDefaultConfig().(*namedpipereceiver.NamedPipeConfig)
cfg.InputConfig.Path = "/tmp/foo"
return cfg
},
},
}

assert.Equal(t, len(rcvrFactories), len(tests), "All receivers must be added to the lifecycle suite")
Expand Down

0 comments on commit bcc7163

Please sign in to comment.