mirror of
https://github.com/openfaas/faas.git
synced 2025-06-21 14:23:25 +00:00
Refactoring: variable names, adding tests and http constants
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
@ -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")
|
||||
}
|
||||
|
Reference in New Issue
Block a user