createDecision is a test helper that creates a decision directly via ent, bypassing the full alert pipeline.
(t *testing.T, ctx context.Context, client *ent.Client, value string, until time.Time)
| 171 | // createDecision is a test helper that creates a decision directly via ent, |
| 172 | // bypassing the full alert pipeline. |
| 173 | func createDecision(t *testing.T, ctx context.Context, client *ent.Client, value string, until time.Time) { |
| 174 | t.Helper() |
| 175 | |
| 176 | rng, err := csnet.NewRange(value) |
| 177 | require.NoError(t, err) |
| 178 | |
| 179 | _, err = client.Decision.Create(). |
| 180 | SetUntil(until). |
| 181 | SetScenario("test"). |
| 182 | SetType("ban"). |
| 183 | SetScope("Ip"). |
| 184 | SetValue(value). |
| 185 | SetOrigin("test"). |
| 186 | SetIPSize(int64(rng.Size())). |
| 187 | SetStartIP(rng.Start.Addr). |
| 188 | SetStartSuffix(rng.Start.Sfx). |
| 189 | SetEndIP(rng.End.Addr). |
| 190 | SetEndSuffix(rng.End.Sfx). |
| 191 | Save(ctx) |
| 192 | require.NoError(t, err) |
| 193 | } |
| 194 | |
| 195 | func TestApplyAllowlistsToExistingDecisions(t *testing.T) { |
| 196 | future := time.Now().UTC().Add(24 * time.Hour) |
no test coverage detected
searching dependent graphs…