From 22459ee17a3ba0b4487f975b6ebe630cab2d9feb Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Thu, 17 Aug 2017 15:05:17 +0100 Subject: PLT-7302: Aggregate Elasticsearch indexes over a certain age. (#7224) * PLT-7302: Aggregate Elasticsearch indexes over a certain age. This is done by a scheduled daily job, in order to keep the shard count to a sensible level in Elasticsearch. * Use map[string]string instead of StringMap --- store/sql_job_store_test.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'store/sql_job_store_test.go') diff --git a/store/sql_job_store_test.go b/store/sql_job_store_test.go index 97e95ab92..394a09192 100644 --- a/store/sql_job_store_test.go +++ b/store/sql_job_store_test.go @@ -17,9 +17,9 @@ func TestJobSaveGet(t *testing.T) { Id: model.NewId(), Type: model.NewId(), Status: model.NewId(), - Data: map[string]interface{}{ - "Processed": 0, - "Total": 12345, + Data: map[string]string{ + "Processed": "0", + "Total": "12345", "LastProcessed": "abcd", }, } @@ -36,6 +36,8 @@ func TestJobSaveGet(t *testing.T) { t.Fatal(result.Err) } else if received := result.Data.(*model.Job); received.Id != job.Id { t.Fatal("received incorrect job after save") + } else if received.Data["Total"] != "12345" { + t.Fatal("data field was not retrieved successfully:", received.Data) } } @@ -184,6 +186,9 @@ func TestJobGetAllByStatus(t *testing.T) { Type: jobType, CreateAt: 1000, Status: status, + Data: map[string]string{ + "test": "data", + }, }, { Id: model.NewId(), @@ -214,10 +219,10 @@ func TestJobGetAllByStatus(t *testing.T) { t.Fatal(result.Err) } else if received := result.Data.([]*model.Job); len(received) != 3 { t.Fatal("received wrong number of jobs") - } else if received[0].Id != jobs[0].Id && received[1].Id != jobs[0].Id { - t.Fatal("should've received first jobs") - } else if received[0].Id != jobs[1].Id && received[1].Id != jobs[1].Id { - t.Fatal("should've received second jobs") + } else if received[0].Id != jobs[1].Id || received[1].Id != jobs[0].Id || received[2].Id != jobs[2].Id { + t.Fatal("should've received jobs ordered by CreateAt time") + } else if received[1].Data["test"] != "data" { + t.Fatal("should've received job data field back as saved") } } @@ -237,7 +242,7 @@ func TestJobUpdateOptimistically(t *testing.T) { job.LastActivityAt = model.GetMillis() job.Status = model.JOB_STATUS_IN_PROGRESS job.Progress = 50 - job.Data = map[string]interface{}{ + job.Data = map[string]string{ "Foo": "Bar", } -- cgit v1.2.3-1-g7c22