LN0739_FM_FR12_EXT: added support for deleting the alarm definitions through cli
[ric-plt/alarm-go.git] / manager / cmd / manager_test.go
index 7398969..838de79 100755 (executable)
 package main
 
 import (
+       "bytes"
        "encoding/json"
        "fmt"
+       "gerrit.o-ran-sc.org/r/ric-plt/alarm-go/alarm"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
+       "github.com/gorilla/mux"
+       "github.com/prometheus/alertmanager/api/v2/models"
        "github.com/stretchr/testify/assert"
        "io"
        "io/ioutil"
@@ -30,15 +35,10 @@ import (
        "net/http"
        "net/http/httptest"
        "os"
+       "strconv"
        "strings"
        "testing"
        "time"
-        "github.com/gorilla/mux"
-        "strconv"
-       "bytes"
-       "gerrit.o-ran-sc.org/r/ric-plt/alarm-go/alarm"
-       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
-       "github.com/prometheus/alertmanager/api/v2/models"
 )
 
 var alarmManager *AlarmManager
@@ -145,11 +145,11 @@ func TestDeleteAlarmDefinitions(t *testing.T) {
 
        //Delete 8004
        req, _ = http.NewRequest("DELETE", "/ric/v1/alarms/define", nil)
-        vars := map[string]string{"alarmId": strconv.FormatUint(8004, 10)}
-        req = mux.SetURLVars(req, vars)
-        handleFunc = http.HandlerFunc(alarmManager.DeleteAlarmDefinition)
-        response = executeRequest(req, handleFunc)
-        checkResponseCode(t, http.StatusOK, response.Code)
+       vars := map[string]string{"alarmId": strconv.FormatUint(8004, 10)}
+       req = mux.SetURLVars(req, vars)
+       handleFunc = http.HandlerFunc(alarmManager.DeleteAlarmDefinition)
+       response = executeRequest(req, handleFunc)
+       checkResponseCode(t, http.StatusOK, response.Code)
 
        //Get 8004 fail
        req, _ = http.NewRequest("GET", "/ric/v1/alarms/define", nil)
@@ -257,7 +257,6 @@ func TestAlarmsSuppresedSucess(t *testing.T) {
        assert.Nil(t, alarmer.Clear(a), "clear failed")
 }
 
-
 func TestInvalidAlarms(t *testing.T) {
        xapp.Logger.Info("TestInvalidAlarms")
        a := alarmer.NewAlarm(1111, alarm.SeverityMajor, "Some App data", "eth 0 1")