fix webhook slack test error

Signed-off-by: peimingming <peimingming@corp.netease.com>
This commit is contained in:
peimingming 2020-03-25 11:08:34 +08:00
parent 2c3552904d
commit 5924658092

View File

@ -9,6 +9,7 @@ import (
commonhttp "github.com/goharbor/harbor/src/common/http" commonhttp "github.com/goharbor/harbor/src/common/http"
"github.com/goharbor/harbor/src/common/models" "github.com/goharbor/harbor/src/common/models"
"github.com/goharbor/harbor/src/lib/log" "github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/pkg/notifier/model"
) )
// DefaultManager ... // DefaultManager ...
@ -94,7 +95,7 @@ func (m *DefaultManager) Delete(policyID int64) error {
func (m *DefaultManager) Test(policy *models.NotificationPolicy) error { func (m *DefaultManager) Test(policy *models.NotificationPolicy) error {
for _, target := range policy.Targets { for _, target := range policy.Targets {
switch target.Type { switch target.Type {
case "http": case model.NotifyTypeHTTP, model.NotifyTypeSlack:
return m.policyHTTPTest(target.Address, target.SkipCertVerify) return m.policyHTTPTest(target.Address, target.SkipCertVerify)
default: default:
return fmt.Errorf("invalid policy target type: %s", target.Type) return fmt.Errorf("invalid policy target type: %s", target.Type)