From ca701de2a16ca055e3a04eb76fec178457924e07 Mon Sep 17 00:00:00 2001 From: Aananth K Date: Thu, 1 Oct 2020 22:31:49 +0530 Subject: [PATCH] Bug Fix e2e tests This Commit, - Fixes build failure due to e2e tests --- pkg/notify/webhook.go | 2 +- pkg/notify/webhook_test.go | 2 +- test/e2e/utils/utils.go | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/notify/webhook.go b/pkg/notify/webhook.go index 11f2c7a0e8..4a9c63cb25 100644 --- a/pkg/notify/webhook.go +++ b/pkg/notify/webhook.go @@ -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 diff --git a/pkg/notify/webhook_test.go b/pkg/notify/webhook_test.go index bc8c25aa0f..a470f4d051 100644 --- a/pkg/notify/webhook_test.go +++ b/pkg/notify/webhook_test.go @@ -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) { diff --git a/test/e2e/utils/utils.go b/test/e2e/utils/utils.go index a7b6e6e7c7..4941a38db3 100644 --- a/test/e2e/utils/utils.go +++ b/test/e2e/utils/utils.go @@ -21,6 +21,7 @@ package utils import ( "testing" + "time" "github.com/nlopes/slack" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -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 }