Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import com.cosmotech.api.home.runner.RunnerConstants.RUNNER_NAME
import com.cosmotech.api.home.runner.RunnerConstants.RUNNER_RUN_TEMPLATE
import com.cosmotech.api.home.withPlatformAdminHeader
import com.cosmotech.common.events.CsmEventPublisher
import com.cosmotech.common.events.HasRunningRuns
import com.cosmotech.common.events.RunStart
import com.cosmotech.common.events.RunnerDeleted
import com.cosmotech.common.events.UpdateRunnerStatus
import com.cosmotech.common.rbac.ROLE_ADMIN
import com.cosmotech.common.rbac.ROLE_NONE
Expand Down Expand Up @@ -636,6 +638,17 @@ class RunnerControllerTests : ControllerTestBase() {

@Test
fun delete_runner() {
val expectedRunId = "run-genid12345"
every { eventPublisher.publishEvent(any()) } answers
{
firstArg<HasRunningRuns>().response = false
} andThenAnswer
{
firstArg<RunnerDeleted>()
} andThenAnswer
{
firstArg<RunStart>().response = expectedRunId
}

val runnerId =
createRunnerAndReturnId(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package com.cosmotech.run.service

import com.cosmotech.common.config.CsmPlatformProperties
import com.cosmotech.common.events.RunStart
import com.cosmotech.common.events.RunType
import com.cosmotech.common.rbac.ROLE_ADMIN
import com.cosmotech.common.rbac.ROLE_NONE
import com.cosmotech.common.tests.CsmTestBase
Expand Down Expand Up @@ -273,7 +274,7 @@ class RunServiceIntegrationTest : CsmTestBase() {
security =
RunnerSecurity(ROLE_ADMIN, mutableListOf(RunnerAccessControl("user", ROLE_ADMIN))),
)
val runStart = RunStart(this, runner)
val runStart = RunStart(this, runner, RunType.Run)
eventPublisher.publishEvent(runStart)
return runStart.response!!
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package com.cosmotech.run

import com.cosmotech.common.config.CsmPlatformProperties
import com.cosmotech.common.containerregistry.ContainerRegistryService
import com.cosmotech.common.events.RunType
import com.cosmotech.common.rbac.ROLE_ADMIN
import com.cosmotech.organization.api.OrganizationApiService
import com.cosmotech.organization.domain.Organization
Expand Down Expand Up @@ -193,6 +194,7 @@ class ContainerFactoryTests {
"CSM_RUNNER_ID" to runner.id,
"CSM_RUN_ID" to runId,
"CSM_RUN_TEMPLATE_ID" to CSM_RUN_TEMPLATE_ID,
"CSM_RUN_TYPE" to RunType.Run.value,
),
entrypoint = "entrypoint.py",
nodeLabel = runTemplate.computeSize!!.removeSuffix("pool"),
Expand Down
Loading