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

Add test coverage for error events #340

Closed
2 of 5 tasks
PrasadG193 opened this issue Sep 19, 2020 · 6 comments
Closed
2 of 5 tasks

Add test coverage for error events #340

PrasadG193 opened this issue Sep 19, 2020 · 6 comments
Labels
good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed test-framework

Comments

@PrasadG193
Copy link
Collaborator

PrasadG193 commented Sep 19, 2020

Describe the bug

In e2e test suite, we mock resource creation with fake client and verify the BotKube event generations.
https://github.com/infracloudio/botkube/blob/develop/test/e2e/notifier/create/create.go#L46

We need to add similar test cases to verify error event handling.
We can use client-go Event interface for creating new event

Resource configuration can be mocked by setting/altering values in utils.AllowedUpdateEventsMap and utils.AllowedEventKindsMap https://github.com/infracloudio/botkube/blob/develop/pkg/utils/utils.go#L148

Add test cases to validate the following behavior:

  • Validate error events are handled for a resource with events: [all] in test config https://github.com/infracloudio/botkube/blob/develop/test/resource_config.yaml - @Divya063

  • Validate error events are handled with only events: [error] config for a resource - @Divya063

  • Validate error events are skipped when error event is not configured for a resource in test config. e.g events: [create, update, delete] - @Divya063

  • Validate that error events are skipped when an event occurs for a namespace which is not configured

  • Validate that error events are skipped when an event occurs for a resource which is not added in resource_config - @Divya063

Each test case can be added as a separate PR. Multiple PR as expected for this task.
Guidelines for contributors:

  • Post comment on the issue informing others about the test case you want to add
  • Mark the issue as done once the PR is merged
  • Please make sure that no one else is working on the same test case to avoid duplicate PRs
@PrasadG193 PrasadG193 added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed test-framework and removed bug Something isn't working labels Sep 19, 2020
@PrasadG193 PrasadG193 changed the title [BUG] Add test coverage for error events Add test coverage for error events Sep 28, 2020
@sheetalsingala
Copy link

Please can I work on this?

@PrasadG193
Copy link
Collaborator Author

Go for it @sheetalsingala. Please let me know if you have any doubts.

@PrasadG193
Copy link
Collaborator Author

Hey @sheetalsingala I've updated the issue description about the test cases we should add. Feel free to choose one or more from the list

@Divya063
Copy link
Contributor

Divya063 commented Oct 3, 2020

@PrasadG193 I would like to work on the following test cases:

  • Validate error events are handled for a resource with events: [all] in test config
  • Validate error events are handled with only events: [error] config for a resource
  • Validate error events are skipped when error event is not configured for a resource in test config. e.g events: [create, update, delete]
  • Validate that error events are skipped when an event occurs for a resource which is not added in resource_config

@PrasadG193
Copy link
Collaborator Author

@Divya063 awesome! Please let me know if you need any help

mergify bot pushed a commit that referenced this issue Oct 26, 2020
- Validates error events are skipped when the error event is not configured for a resource in test config.
- Validate that error events are skipped when an event occurs for a namespace which is not added in resource_config
Fixes part of #340
mergify bot pushed a commit that referenced this issue Oct 30, 2020
@pkosiec pkosiec mentioned this issue May 20, 2022
3 tasks
@pkosiec
Copy link
Collaborator

pkosiec commented Aug 26, 2022

Hi,
I'm closing this task as not valid anymore, as we switched to the E2E tests with real Slack and Kubernetes APIs and we have covered the feature in E2E and unit tests.
We can discuss new ideas under this epic: #589.

Thanks everyone involved!

@pkosiec pkosiec closed this as completed Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed test-framework
Projects
None yet
Development

No branches or pull requests

4 participants