botkube icon indicating copy to clipboard operation
botkube copied to clipboard

Add test coverage for '@BotKube notifier showconfig` command

Open PrasadG193 opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe.

Test coverage is missing for notifier commands

Describe the solution you'd like

@BotKube notifier showconfig displays resource configuration that BotKube monitors and notifies about. See https://www.botkube.io/usage/#view-botkube-configuration

Integration tests for validating BotKube command responses are implemented here: https://github.com/infracloudio/botkube/blob/develop/test/e2e/command/botkube.go#L46

Add test case to validate @BotKube notifier showconfig command in the existing table drive test cases

PrasadG193 avatar Sep 28 '20 05:09 PrasadG193

@PrasadG193 can I work on this issue?

anoopmsivadas avatar Sep 28 '20 12:09 anoopmsivadas

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

PrasadG193 avatar Sep 28 '20 13:09 PrasadG193

hi @PrasadG193 , I'm facing issues while testing.This happens everytime i run the test on my local machine. I tried without making any changes

ok  	github.com/infracloudio/botkube/pkg/filterengine/filters	(cached)
?   	github.com/infracloudio/botkube/pkg/log	[no test files]
?   	github.com/infracloudio/botkube/pkg/metrics	[no test files]
# github.com/infracloudio/botkube/pkg/notify
pkg/notify/webhook.go:130:50: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
pkg/notify/webhook_test.go:41:44: conversion from untyped int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
FAIL	github.com/infracloudio/botkube/pkg/notify [build failed]
FAIL

Update I fixed the issue using rune() . For instance fmt.Errorf("Error Posting Webhook: %s", string(rune(http.StatusServiceUnavailable))), in webhook_test.go And I'm not sure if it's the right method. go version : 1.15.2 on Debian 10

anoopmsivadas avatar Sep 29 '20 03:09 anoopmsivadas

@anoopmsivadas We use Go 1.13 in CI (https://github.com/infracloudio/botkube/blob/develop/.github/workflows/ci.yml#L18). Can you please try once with 1.13?

PrasadG193 avatar Sep 29 '20 04:09 PrasadG193

Hi, closing this issue as we'll add the tests once we rework the commands to unify its naming (hopefully soon) - https://github.com/kubeshop/botkube/issues/703. Cheers!

pkosiec avatar Aug 26 '22 11:08 pkosiec