Minor fix

This commit is contained in:
TwinProduction 2021-01-08 22:56:13 -05:00
parent 329bd86e09
commit eaf205eded

View File

@ -13,7 +13,7 @@ var (
secondCondition = core.Condition("[RESPONSE_TIME] < 500")
thirdCondition = core.Condition("[CERTIFICATE_EXPIRATION] < 72h")
timestamp, _ = time.Parse(time.RFC3339, "2021-01-08T21:41:18-05:00")
timestamp = time.Date(2020, 4, 29, 12, 45, 0, 0, time.UTC)
testService = core.Service{
Name: "name",
@ -175,8 +175,8 @@ func TestInMemoryStore_GetAllAsJSON(t *testing.T) {
if err != nil {
t.Fatal("shouldn't have returned an error, got", err.Error())
}
expectedOutput := `{"group_name":{"name":"name","group":"group","results":[{"status":200,"hostname":"example.org","duration":150000000,"errors":null,"condition-results":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":true},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":true}],"success":true,"timestamp":"2021-01-08T21:41:18-05:00"},{"status":200,"hostname":"example.org","duration":750000000,"errors":["error-1","error-2"],"condition-results":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":false},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":false}],"success":false,"timestamp":"2021-01-08T21:41:18-05:00"}],"uptime":{"7d":0.5,"24h":0.5,"1h":0.5}}}`
expectedOutput := `{"group_name":{"name":"name","group":"group","results":[{"status":200,"hostname":"example.org","duration":150000000,"errors":null,"condition-results":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":true},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":true}],"success":true,"timestamp":"2020-04-29T12:45:00Z"},{"status":200,"hostname":"example.org","duration":750000000,"errors":["error-1","error-2"],"condition-results":[{"condition":"[STATUS] == 200","success":true},{"condition":"[RESPONSE_TIME] \u003c 500","success":false},{"condition":"[CERTIFICATE_EXPIRATION] \u003c 72h","success":false}],"success":false,"timestamp":"2020-04-29T12:45:00Z"}],"uptime":{"7d":0.5,"24h":0.5,"1h":0.5}}}`
if string(output) != expectedOutput {
t.Error()
t.Error(string(output))
}
}