Skip to content

Commit

Permalink
Bug Fix e2e tests
Browse files Browse the repository at this point in the history
This Commit,
- Fixes build failure due to e2e tests
  • Loading branch information
codenio committed Oct 2, 2020
1 parent bc983c3 commit ca701de
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/notify/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (w *Webhook) PostWebhook(jsonPayload *WebhookPayload) error {
return err
}
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("Error Posting Webhook: %s", string(resp.StatusCode))
return fmt.Errorf("Error Posting Webhook: %s", fmt.Sprint(resp.StatusCode))
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/notify/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestPostWebhook(t *testing.T) {
httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusServiceUnavailable)
})),
fmt.Errorf("Error Posting Webhook: %s", string(http.StatusServiceUnavailable)),
fmt.Errorf("Error Posting Webhook: %s", fmt.Sprint(http.StatusServiceUnavailable)),
},
`Status Ok`: {
httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package utils

import (
"testing"
"time"

"github.com/nlopes/slack"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -104,11 +105,15 @@ func UpdateResource(t *testing.T, obj UpdateObjects) (*unstructured.Unstructured
if err != nil {
t.Fatalf("Failed to create %s: %v", obj.GVR.Resource, err)
}
// Provide Sufficient time interval for messages to reach fack servers
time.Sleep(30 * time.Second)
// Applying patch
newObj, err := utils.DynamicKubeClient.Resource(obj.GVR).Namespace(obj.Namespace).Patch(s.GetName(), types.MergePatchType, obj.Patch, v1.PatchOptions{})

if err != nil {
t.Fatalf("Failed to update %s: %v", obj.GVR.Resource, err)
}
// Provide Sufficient time interval for messages to reach fack servers
time.Sleep(30 * time.Second)
return oldObj, newObj
}

0 comments on commit ca701de

Please sign in to comment.