(t *testing.T)
| 202 | } |
| 203 | |
| 204 | func TestCreateAlertChannels(t *testing.T) { |
| 205 | ctx := t.Context() |
| 206 | apiServer, config := NewAPIServer(t, ctx) |
| 207 | apiServer.controller.PluginChannel = make(chan models.ProfileAlert) |
| 208 | err := apiServer.InitController() |
| 209 | require.NoError(t, err) |
| 210 | |
| 211 | loginResp := LoginToTestAPI(t, ctx, apiServer.router, config) |
| 212 | lapi := LAPI{router: apiServer.router, loginResp: loginResp} |
| 213 | |
| 214 | var ( |
| 215 | pd models.ProfileAlert |
| 216 | wg sync.WaitGroup |
| 217 | ) |
| 218 | |
| 219 | wg.Add(1) |
| 220 | |
| 221 | go func() { |
| 222 | pd = <-apiServer.controller.PluginChannel |
| 223 | |
| 224 | wg.Done() |
| 225 | }() |
| 226 | |
| 227 | lapi.InsertAlertFromFile(t, ctx, "./tests/alert_ssh-bf.json") |
| 228 | wg.Wait() |
| 229 | assert.Len(t, pd.Alert.Decisions, 1) |
| 230 | apiServer.Close() |
| 231 | } |
| 232 | |
| 233 | func TestAlertListFilters(t *testing.T) { |
| 234 | ctx := t.Context() |
nothing calls this directly
no test coverage detected
searching dependent graphs…