-
Notifications
You must be signed in to change notification settings - Fork 290
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
added test for skip delete event when resources are not added in test_config #405
added test for skip delete event when resources are not added in test_config #405
Conversation
@A-kanksh-a should we wrap the conditions to check if an event is allowed in functions and use that in tests?
|
@PrasadG193 will do the changes. |
…ithub.com/A-kanksh-a/botkube into skip_delete_event_for_resources_not_added
test/e2e/utils/utils.go
Outdated
@@ -149,3 +149,17 @@ func DeleteResource(t *testing.T, obj DeleteObjects) { | |||
t.Fatalf("Failed to delete %s: %v", obj.GVR.Resource, err) | |||
} | |||
} | |||
|
|||
// CheckOperationAllowed checks whether operation are allowed | |||
func CheckOperationAllowed(eventMap map[utils.EventKind]bool, namespace string, resource string, eventType config.EventType) bool { |
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.
@A-kanksh-a I meant to add this function in pkg/utils
and use it in controller.go as well
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.
yes we can do that.
pkg/utils/utils.go
Outdated
|
||
// CheckOperationAllowed checks whether operation are allowed | ||
func CheckOperationAllowed(eventMap map[EventKind]bool, namespace string, resource string, eventType config.EventType) bool { | ||
if eventMap[EventKind{ |
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.
Please check if eventMap
is nil
before accessing the fields
Hello @A-kanksh-a , Thank you for contributing to BotKube. Could you please fill out this form, so we can send the well deserved awesome swags 🙂 Team BotKube |
ISSUE TYPE
SUMMARY
Added skip delete event test case that should be skipped if event occurred for a resource which is not added in test configuration.
Modified AllowedEventKindsMap to removed the v1/services resource
Fixes test case - Validate that delete events are skipped when an event occurs for a resource which is not added in resource_config of issue #354