-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Ensure all exporters are added to lifecycle test #6933
Conversation
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.
There was a problem hiding this 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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @AbhiPrasad
@@ -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) |
There was a problem hiding this comment.
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
600d53d
to
c51624c
Compare
7dd56b2
to
1ace367
Compare
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. |
There was a problem hiding this 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @AbhiPrasad
} | ||
|
||
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
I'll merge this PR as is, but if there are concerns about the sentry exporter, please open an issue to address them, @AbhiPrasad. |
…y#6933) * Update all modules to use v0.69.0 and 1.0.0-rc3 of collector modules
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.