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

[chore]move googlecloudpubsubreceiver to generated lifecycle tests #29940

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions receiver/googlecloudpubsubreceiver/generated_component_test.go

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

8 changes: 8 additions & 0 deletions receiver/googlecloudpubsubreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ status:
distributions: [observiq, sumo]
codeowners:
active: [alexvanboxel]

tests:
config:
project: my-project
user_agent: user-agent
timeout: 20s
subscription: projects/my-project/subscriptions/otlp-subscription
skip_lifecycle: true
codeboten marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions receiver/googlecloudpubsubreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ func (receiver *pubsubReceiver) Start(ctx context.Context, _ component.Host) err
}

func (receiver *pubsubReceiver) Shutdown(_ context.Context) error {
if receiver.handler == nil {
return nil
}
receiver.logger.Info("Stopping Google Pubsub receiver")
receiver.handler.CancelNow()
Copy link
Contributor

Choose a reason for hiding this comment

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

the check for nil might be better around this call to still have the logs?

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 don’t think we are stopping anything if we didn’t start, so no logging might be best. Codeowners might know best.

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, the handler is the thing that needs to be stopped and will consume resources. So nothing needs to be logged.

receiver.logger.Info("Stopped Google Pubsub receiver")
Expand Down