From f58710221ea7d97c30cf4d1d62d6239ea32415be Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Mon, 8 Jun 2020 14:58:26 -0500 Subject: [PATCH] Maybe fix intermittently failing test --- services/tickets/zendesk/service.go | 6 +++++- services/tickets/zendesk/testdata/event_callback.json | 4 ++++ services/tickets/zendesk/web_test.go | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/services/tickets/zendesk/service.go b/services/tickets/zendesk/service.go index 50fe626df..ef0ab1fec 100644 --- a/services/tickets/zendesk/service.go +++ b/services/tickets/zendesk/service.go @@ -1,6 +1,7 @@ package zendesk import ( + "encoding/json" "fmt" "net/http" @@ -67,7 +68,10 @@ func NewService(httpClient *http.Client, httpRetries *httpx.RetryConfig, tickete triggerID: triggerID, }, nil } - return nil, errors.New("missing subdomain or secret or oauth_token or push_id or push_token in zendesk config") + + marshaled, _ := json.Marshal(config) + + return nil, errors.Errorf("missing subdomain or secret or oauth_token or push_id or push_token in zendesk config: %s", marshaled) } // Open opens a ticket which for mailgun means just sending an initial email diff --git a/services/tickets/zendesk/testdata/event_callback.json b/services/tickets/zendesk/testdata/event_callback.json index f9f674942..01adec2f8 100644 --- a/services/tickets/zendesk/testdata/event_callback.json +++ b/services/tickets/zendesk/testdata/event_callback.json @@ -184,6 +184,10 @@ { "query": "select count(*) from tickets_ticketer where config @> '{\"target_id\": \"15\", \"trigger_id\": \"23\"}'", "count": 0 + }, + { + "query": "select count(*) from tickets_ticketer where config @> '{\"subdomain\": \"nyaruka\", \"oauth_token\": \"754845822\", \"secret\": \"sesame\"}'", + "count": 1 } ] }, diff --git a/services/tickets/zendesk/web_test.go b/services/tickets/zendesk/web_test.go index 96349b6a5..0066364ed 100644 --- a/services/tickets/zendesk/web_test.go +++ b/services/tickets/zendesk/web_test.go @@ -9,6 +9,7 @@ import ( ) func TestChannelback(t *testing.T) { + models.FlushCache() testsuite.Reset() db := testsuite.DB() @@ -20,6 +21,7 @@ func TestChannelback(t *testing.T) { } func TestEventCallback(t *testing.T) { + models.FlushCache() testsuite.Reset() db := testsuite.DB() @@ -31,6 +33,7 @@ func TestEventCallback(t *testing.T) { } func TestTarget(t *testing.T) { + models.FlushCache() testsuite.Reset() db := testsuite.DB()