Skip to content

Commit 9e4623f

Browse files
committed
Add tests
1 parent 7598ff4 commit 9e4623f

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

Diff for: service/src/main/kotlin/app/cash/backfila/dashboard/CreateBackfillAction.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import misk.web.actions.WebAction
1616
import misk.web.mediatype.MediaTypes
1717

1818
class CreateBackfillAction @Inject constructor(
19-
private val callerProvider: @JvmSuppressWildcards ActionScoped<MiskCaller?>,
19+
private val caller: @JvmSuppressWildcards ActionScoped<MiskCaller?>,
2020
private val backfillCreator: BackfillCreator,
2121
) : WebAction {
2222
@Post("/services/{service}/variants/{variant}/create")
@@ -37,7 +37,7 @@ class CreateBackfillAction @Inject constructor(
3737
request: CreateBackfillRequest,
3838
): CreateBackfillResponse {
3939
// TODO check user has permissions for this service with access api
40-
val id = backfillCreator.create(callerProvider.get()!!.user!!, service, variant, request)
40+
val id = backfillCreator.create(caller.get()!!.user!!, service, variant, request)
4141

4242
return CreateBackfillResponse(id.id)
4343
}

Diff for: service/src/test/kotlin/app/cash/backfila/service/listener/AuditClientListenerTest.kt

+18-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class AuditClientListenerTest {
156156
applicationName = "deep-fryer",
157157
approverLDAP = "molly",
158158
automatedChange = true,
159-
description = "Backfill started by molly [dryRun=true][service=deep-fryer][backfill=ChickenSandwich][id=${response.backfill_run_id}]",
159+
description = "Backfill paused due to error [dryRun=true][service=deep-fryer][backfill=ChickenSandwich][id=${response.backfill_run_id}]",
160160
richDescription = null,
161161
environment = "testing",
162162
detailURL = "/backfills/${response.backfill_run_id}",
@@ -168,6 +168,23 @@ class AuditClientListenerTest {
168168

169169
auditClientListener.runCompleted(Id(response.backfill_run_id))
170170
assertEquals(4, fakeAuditClient.sentEvents.size)
171+
assertEquals(
172+
FakeAuditClient.FakeAuditEvent(
173+
eventSource = "backfila",
174+
eventTarget = "ChickenSandwich",
175+
timestampSent = 2147483647,
176+
applicationName = "deep-fryer",
177+
approverLDAP = "molly",
178+
automatedChange = true,
179+
description = "Backfill completed [dryRun=true][service=deep-fryer][backfill=ChickenSandwich][id=${response.backfill_run_id}]",
180+
richDescription = null,
181+
environment = "testing",
182+
detailURL = "/backfills/${response.backfill_run_id}",
183+
region = "us-west-2",
184+
requestorLDAP = "molly",
185+
),
186+
fakeAuditClient.sentEvents.last(),
187+
)
171188
}
172189
}
173190
}

0 commit comments

Comments
 (0)