Refactoring: variable names, adding tests and http constants

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis
2017-12-01 18:19:54 +00:00
parent 2452fdea0b
commit 23a7187435
19 changed files with 166 additions and 80 deletions

View File

@ -4,11 +4,9 @@
package tests
import (
"testing"
"io/ioutil"
"encoding/json"
"io/ioutil"
"testing"
"github.com/openfaas/faas/gateway/requests"
)
@ -19,21 +17,27 @@ func TestUnmarshallAlert(t *testing.T) {
var alert requests.PrometheusAlert
err := json.Unmarshal(file, &alert)
if err != nil {
t.Fatal(err)
}
if (len(alert.Status)) == 0 {
t.Fatal("No status read")
}
if (len(alert.Receiver)) == 0 {
t.Fatal("No status read")
}
if (len(alert.Alerts)) == 0 {
t.Fatal("No alerts read")
}
if (len(alert.Alerts[0].Labels.AlertName)) == 0 {
t.Fatal("No alerts name")
}
if (len(alert.Alerts[0].Labels.FunctionName)) == 0 {
t.Fatal("No function name read")
}