Skip to content
Snippets Groups Projects
Commit 158c4122 authored by Alex Ellis's avatar Alex Ellis
Browse files

Initial test for alert unmarshall

parent ff429ce4
No related branches found
No related tags found
No related merge requests found
......@@ -21,3 +21,8 @@ type AlexaRequestBody struct {
Session AlexaSession `json:"session"`
Request AlexaRequest `json:"request"`
}
type PrometheusAlert struct {
Status string `json:"status"`
Receiver string `json:"receiver"`
}
File moved
package requests
import (
"fmt"
"testing"
"io/ioutil"
"encoding/json"
"github.com/alexellis/faas/gateway/requests"
)
func TestUnmarshallAlert(t *testing.T) {
file, _ := ioutil.ReadFile("./test_alert.json")
var alert requests.PrometheusAlert
err := json.Unmarshal(file, &alert)
if err != nil {
t.Fatal(err)
}
fmt.Println("OK", string(file), alert)
if (len(alert.Status)) == 0 {
t.Fatal("No status read")
}
if (len(alert.Receiver)) == 0 {
t.Fatal("No status read")
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment