-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add lifecycle tests to all default components #2741
Add lifecycle tests to all default components #2741
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2741 +/- ##
==========================================
+ Coverage 91.77% 91.81% +0.04%
==========================================
Files 291 291
Lines 15535 15535
==========================================
+ Hits 14257 14264 +7
+ Misses 877 870 -7
Partials 401 401
Continue to review full report at Codecov.
|
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.
Nice. So this uncovered some bugs.
@tigrannajaryan bugs based on? I think we need first to document the requirements before claiming that something is a bug :) |
@bogdandrutu My understanding from the skipped tests is that some components fail the Create/Start/Shutdown/Create/Start/Shutdown sequence (did I misunderstand it?). I think we can consider that a bug, given our discussions about how we should be able to restart the Collector with a new config. Sure, let's document the requirement clearly. |
Not sure if I would call missunderstand but the sequence that is tested is Create/Start/Create/Shutdown/Start/Shutdown so let's document exactly what is the expectations so I can ensure that we test what is expected. I understand the need to be able to restart the collector, but let's document that and then we can push all these PRs |
@pjanotti I think @bogdandrutu is right, the test verifies the sequence where we create the second instance before we shutdown the first. I think the actual sequence we need is Create/Start/Shutdown/Create/Start/Shutdown, right? It should be easy to change the test to do this instead. |
Please update tests accordingly to #2757 |
|
||
secondExp, err := createFn(ctx, expCreateParams, getConfigFn()) | ||
require.NoError(t, err) | ||
|
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.
Remove empty line.
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.
done
if err == configerror.ErrDataTypeIsNotSupported { | ||
continue | ||
} |
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.
if errors.Is(err, configerror.ErrDataTypeIsNotSupported)
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.
done
|
||
secondExt, err := factory.CreateExtension(ctx, extCreateParams, getConfigFn()) | ||
assert.NoError(t, err) | ||
require.NoError(t, err) | ||
|
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.
Remove new line
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.
done
|
||
for _, createFn := range createFns { | ||
firstExp, err := createFn(ctx, processorCreateParams, getConfigFn()) | ||
if err == configerror.ErrDataTypeIsNotSupported { |
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.
Same use errors.Is
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.
done
|
||
secondExp, err := createFn(ctx, processorCreateParams, getConfigFn()) | ||
require.NoError(t, err) | ||
|
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.
Same, remove new line
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.
done
func castProcessor(p component.Processor, err error) (component.Processor, error) { | ||
return p, err | ||
} |
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.
Not sure I understand this func. Is this necessary? If yes please comment why.
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.
removed, not needed anymore
|
||
for _, createFn := range createFns { | ||
firstRcvr, err := createFn(ctx, receiverCreateParams, getConfigFn()) | ||
if err == configerror.ErrDataTypeIsNotSupported { |
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.
same comment.
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.
done
|
||
secondRcvr, err := createFn(ctx, receiverCreateParams, getConfigFn()) | ||
require.NoError(t, err) | ||
|
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.
same comment.
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.
done
} | ||
} | ||
|
||
func castReceiver(p component.Receiver, err error) (component.Receiver, error) { |
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.
same is this necessary?
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.
removed, not needed anymore.
} | ||
} | ||
|
||
func castExporter(exp component.Exporter, err error) (component.Exporter, error) { |
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.
is this necessary? please comment why.
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.
It was not necessary anymore, perhaps it was needed on the initial version definitely not anymore, removed.
Please consider to update description if necessary. |
…etry#2741) Bumps [pygithub](https://github.com/pygithub/pygithub) from 1.58.0 to 1.58.1. - [Release notes](https://github.com/pygithub/pygithub/releases) - [Changelog](https://github.com/PyGithub/PyGithub/blob/v1.58.1/doc/changes.rst) - [Commits](PyGithub/PyGithub@v1.58.0...v1.58.1) --- updated-dependencies: - dependency-name: pygithub dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Why
Add lifetime tests to remaining default components in line with #2679. This allows changing the components without restarting the process.
What
Description:
Separate the default components test per type of component and also allow to run the test for a single component. Some receivers are not being tested for lifecycle in this PR: