Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all exporters are added to lifecycle test #6933

Merged

Conversation

MovieStoreGuy
Copy link
Contributor

Description:
In order to help test coverage up and ensuring that all components are
tested, I have added what I could to the lifecycle tests for exporters
while adding two additional helps within test util.

Link to tracking Issue:
Yet to check if there was an open issue for this

Testing:
Tests were only added for validate the new test helpers, the rest were extending test suites that already exist.

Documentation:
The documentation had been updated in an earlier PR to include adding new components as part of these lifecycle tests.

In order to help test coverage up and ensuring that all components are
tested, I have added what I could to the lifecycle tests for exporters
while adding two additional helps within test util.
Copy link
Contributor Author

@MovieStoreGuy MovieStoreGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding comments as to why I made some choices

@@ -444,7 +443,7 @@ func CreateSentryExporter(config *Config, set component.ExporterCreateSettings)
allEventsFlushed := transport.Flush(ctx)

if !allEventsFlushed {
log.Print("Could not flush all events, reached timeout")
set.Logger.Warn("Could not flush all events, reached timeout")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this due to the amount of spam it produced throughout testing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -60,8 +82,7 @@ func TestDefaultExporters(t *testing.T) {
exporter: "file",
getConfigFn: func() config.Exporter {
cfg := expFactories["file"].CreateDefaultConfig().(*fileexporter.Config)
f, err := ioutil.TempFile("", "otelcol_defaults_file_exporter_test*.tmp")
require.NoError(t, err)
f := testutil.NewTemporaryFile(t)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to test helper so my /tmp would clear up after each test run

internal/components/exporters_test.go Outdated Show resolved Hide resolved
@MovieStoreGuy
Copy link
Contributor Author

I did notice there is a few exports that haven't been added into components list as of yet, not sure if there are already issues to follow up on those.

@jpkrohling jpkrohling added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Dec 27, 2021
Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

@@ -444,7 +443,7 @@ func CreateSentryExporter(config *Config, set component.ExporterCreateSettings)
allEventsFlushed := transport.Flush(ctx)

if !allEventsFlushed {
log.Print("Could not flush all events, reached timeout")
set.Logger.Warn("Could not flush all events, reached timeout")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

assert.Equal(t, len(tests)+25 /* not tested */, len(expFactories))
assert.Equal(t, len(tests), len(expFactories), "All user configurable components must be added to the lifecycle test")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use assert.Len here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add them in a follow up PR

@jpkrohling
Copy link
Member

I'll merge this PR as is, but if there are concerns about the sentry exporter, please open an issue to address them, @AbhiPrasad.

@jpkrohling jpkrohling merged commit 15d5e25 into open-telemetry:main Dec 27, 2021
animetauren pushed a commit to animetauren/opentelemetry-collector-contrib that referenced this pull request Apr 4, 2023
…y#6933)

* Update all modules to use v0.69.0 and 1.0.0-rc3 of collector modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants