Skip to content

Commit 5652e74

Browse files
committed
Remove ownerName field and introduce additionalData in Runner schema
- Replaced `ownerName` with `additionalData` as a flexible key-value structure in Runner schema. - Updated OpenAPI specification, integration tests, model classes, and documentation accordingly. - Adjusted test cases and API calls to reflect schema changes with backward compatibility considerations.
1 parent 14846f8 commit 5652e74

File tree

13 files changed

+56
-80
lines changed

13 files changed

+56
-80
lines changed

api/src/integrationTest/kotlin/com/cosmotech/api/home/ControllerTestUtils.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import com.cosmotech.api.home.dataset.DatasetConstants.DATASET_PART_NAME
99
import com.cosmotech.api.home.dataset.DatasetConstants.TEST_FILE_NAME
1010
import com.cosmotech.api.home.organization.OrganizationConstants.ORGANIZATION_NAME
1111
import com.cosmotech.api.home.runner.RunnerConstants.RUNNER_NAME
12-
import com.cosmotech.api.home.runner.RunnerConstants.RUNNER_OWNER_NAME
1312
import com.cosmotech.api.home.solution.SolutionConstants.SOLUTION_KEY
1413
import com.cosmotech.api.home.solution.SolutionConstants.SOLUTION_NAME
1514
import com.cosmotech.api.home.solution.SolutionConstants.SOLUTION_REPOSITORY
@@ -170,7 +169,7 @@ class ControllerTestUtils {
170169
runTemplateName: String? = null,
171170
security: RunnerSecurity? = null,
172171
runSizing: RunnerResourceSizing? = null,
173-
ownerName: String = RUNNER_OWNER_NAME,
172+
additionalData: MutableMap<String, Any>? = null,
174173
description: String = "",
175174
tags: MutableList<String> = mutableListOf(),
176175
datasetList: MutableList<String>? = mutableListOf(),
@@ -181,7 +180,7 @@ class ControllerTestUtils {
181180
name = name,
182181
solutionId = solutionId,
183182
runTemplateId = runTemplateId,
184-
ownerName = ownerName,
183+
additionalData = additionalData,
185184
description = description,
186185
tags = tags,
187186
datasetList = datasetList,
@@ -200,7 +199,7 @@ class ControllerTestUtils {
200199
solutionName: String? = null,
201200
runTemplateName: String? = null,
202201
runSizing: RunnerResourceSizing? = null,
203-
ownerName: String = RUNNER_OWNER_NAME,
202+
additionalData: MutableMap<String, Any>? = null,
204203
description: String = "",
205204
tags: MutableList<String> = mutableListOf(),
206205
datasetList: MutableList<String>? = mutableListOf(),
@@ -215,7 +214,7 @@ class ControllerTestUtils {
215214
datasetList = datasetList,
216215
runSizing = runSizing,
217216
parametersValues = parametersValues,
218-
ownerName = ownerName,
217+
additionalData = additionalData,
219218
solutionName = solutionName,
220219
runTemplateName = runTemplateName)
221220
}

api/src/integrationTest/kotlin/com/cosmotech/api/home/runner/RunnerConstants.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ package com.cosmotech.api.home.runner
1010
object RunnerConstants {
1111

1212
const val RUNNER_NAME = "my_runner_name"
13-
const val RUNNER_OWNER_NAME = "John Doe"
1413
const val RUNNER_RUN_TEMPLATE = "runtemplate1"
1514
const val NEW_USER_ID = "[email protected]"
1615
const val NEW_USER_ROLE = "editor"
17-
const val NEW_RUNNER_NAME = "my_new_runner_name"
1816

1917
object RequestContent {}
2018

api/src/integrationTest/kotlin/com/cosmotech/api/home/runner/RunnerControllerTests.kt

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import com.cosmotech.api.home.organization.OrganizationConstants
2222
import com.cosmotech.api.home.runner.RunnerConstants.NEW_USER_ID
2323
import com.cosmotech.api.home.runner.RunnerConstants.NEW_USER_ROLE
2424
import com.cosmotech.api.home.runner.RunnerConstants.RUNNER_NAME
25-
import com.cosmotech.api.home.runner.RunnerConstants.RUNNER_OWNER_NAME
2625
import com.cosmotech.api.home.runner.RunnerConstants.RUNNER_RUN_TEMPLATE
2726
import com.cosmotech.common.events.CsmEventPublisher
2827
import com.cosmotech.common.events.RunStart
@@ -170,6 +169,9 @@ class RunnerControllerTests : ControllerTestBase() {
170169
val tags = mutableListOf("tags1", "tags2")
171170
val datasetList = mutableListOf(datasetId)
172171
val runnerParameterValue = "parameter_value"
172+
val additionalData =
173+
mutableMapOf(
174+
"you_can_put" to "whatever_you_want_here", "even" to mapOf("object" to "if_you_want"))
173175

174176
val parentId =
175177
createRunnerAndReturnId(
@@ -203,7 +205,7 @@ class RunnerControllerTests : ControllerTestBase() {
203205
cpu = "cpu_limits",
204206
memory = "memory_limits",
205207
)),
206-
ownerName = RUNNER_OWNER_NAME,
208+
additionalData = additionalData,
207209
description = description,
208210
tags = tags,
209211
datasetList = datasetList,
@@ -225,7 +227,7 @@ class RunnerControllerTests : ControllerTestBase() {
225227
.andExpect(jsonPath("$.name").value(RUNNER_NAME))
226228
.andExpect(jsonPath("$.createInfo.userId").value(PLATFORM_ADMIN_EMAIL))
227229
.andExpect(jsonPath("$.updateInfo.userId").value(PLATFORM_ADMIN_EMAIL))
228-
.andExpect(jsonPath("$.ownerName").value(RUNNER_OWNER_NAME))
230+
.andExpect(jsonPath("$.additionalData").value(additionalData))
229231
.andExpect(jsonPath("$.description").value(description))
230232
.andExpect(jsonPath("$.parentId").value(parentId))
231233
.andExpect(jsonPath("$.solutionName").value(solutionName))
@@ -260,6 +262,10 @@ class RunnerControllerTests : ControllerTestBase() {
260262
val runnerParameterValue = "parameter_value"
261263
val runnerParameterVarType = "this_is_a_vartype"
262264

265+
val additionalData =
266+
mutableMapOf(
267+
"you_can_put" to "whatever_you_want_here", "even" to mapOf("object" to "if_you_want"))
268+
263269
val parentId =
264270
createRunnerAndReturnId(
265271
mvc,
@@ -297,7 +303,7 @@ class RunnerControllerTests : ControllerTestBase() {
297303
cpu = "cpu_limits",
298304
memory = "memory_limits",
299305
)),
300-
ownerName = RUNNER_OWNER_NAME,
306+
additionalData = additionalData,
301307
description = description,
302308
tags = tags,
303309
datasetList = datasetList,
@@ -318,7 +324,7 @@ class RunnerControllerTests : ControllerTestBase() {
318324
.andExpect(jsonPath("$.name").value(RUNNER_NAME))
319325
.andExpect(jsonPath("$.createInfo.userId").value(PLATFORM_ADMIN_EMAIL))
320326
.andExpect(jsonPath("$.updateInfo.userId").value(PLATFORM_ADMIN_EMAIL))
321-
.andExpect(jsonPath("$.ownerName").value(RUNNER_OWNER_NAME))
327+
.andExpect(jsonPath("$.additionalData").value(additionalData))
322328
.andExpect(jsonPath("$.description").value(description))
323329
.andExpect(jsonPath("$.parentId").value(parentId))
324330
.andExpect(jsonPath("$.solutionName").value(solutionName))
@@ -357,6 +363,11 @@ class RunnerControllerTests : ControllerTestBase() {
357363
val runnerParameterValue = "parameter_value"
358364
val runnerParameterVarType = "this_is_a_vartype"
359365

366+
val additionalData =
367+
mutableMapOf(
368+
"you_can_put_also" to "whatever_you_want_here",
369+
"even" to mapOf("object" to "if_you_want_too"))
370+
360371
val baseRunnerId =
361372
createRunnerAndReturnId(
362373
mvc,
@@ -382,7 +393,7 @@ class RunnerControllerTests : ControllerTestBase() {
382393
cpu = "cpu_limits",
383394
memory = "memory_limits",
384395
)),
385-
ownerName = RUNNER_OWNER_NAME,
396+
additionalData = additionalData,
386397
description = description,
387398
tags = tags,
388399
datasetList = datasetList,
@@ -405,7 +416,7 @@ class RunnerControllerTests : ControllerTestBase() {
405416
.andExpect(jsonPath("$.name").value(RUNNER_NAME))
406417
.andExpect(jsonPath("$.createInfo.userId").value(PLATFORM_ADMIN_EMAIL))
407418
.andExpect(jsonPath("$.updateInfo.userId").value(PLATFORM_ADMIN_EMAIL))
408-
.andExpect(jsonPath("$.ownerName").value(RUNNER_OWNER_NAME))
419+
.andExpect(jsonPath("$.additionalData").value(additionalData))
409420
.andExpect(jsonPath("$.description").value(description))
410421
.andExpect(jsonPath("$.parentId").value(null))
411422
.andExpect(jsonPath("$.solutionName").value(solutionName))
@@ -434,7 +445,6 @@ class RunnerControllerTests : ControllerTestBase() {
434445
fun list_runners() {
435446

436447
val firstRunnerName = "my_first_runner"
437-
val firstOwnerName = "firstRunnerOwner"
438448
val firstRunnerId =
439449
createRunnerAndReturnId(
440450
mvc,
@@ -443,11 +453,9 @@ class RunnerControllerTests : ControllerTestBase() {
443453
constructRunnerObject(
444454
name = firstRunnerName,
445455
solutionId = solutionId,
446-
runTemplateId = RUNNER_RUN_TEMPLATE,
447-
ownerName = firstOwnerName))
456+
runTemplateId = RUNNER_RUN_TEMPLATE))
448457

449458
val secondRunnerName = "my_second_runner"
450-
val secondOwnerName = "secondRunnerOwner"
451459
val secondRunnerId =
452460
createRunnerAndReturnId(
453461
mvc,
@@ -456,8 +464,7 @@ class RunnerControllerTests : ControllerTestBase() {
456464
constructRunnerObject(
457465
name = secondRunnerName,
458466
solutionId = solutionId,
459-
runTemplateId = RUNNER_RUN_TEMPLATE,
460-
ownerName = secondOwnerName))
467+
runTemplateId = RUNNER_RUN_TEMPLATE))
461468

462469
mvc.perform(
463470
get("/organizations/$organizationId/workspaces/$workspaceId/runners")
@@ -468,7 +475,6 @@ class RunnerControllerTests : ControllerTestBase() {
468475
.andExpect(jsonPath("$[0].name").value(firstRunnerName))
469476
.andExpect(jsonPath("$[0].createInfo.userId").value(PLATFORM_ADMIN_EMAIL))
470477
.andExpect(jsonPath("$[0].updateInfo.userId").value(PLATFORM_ADMIN_EMAIL))
471-
.andExpect(jsonPath("$[0].ownerName").value(firstOwnerName))
472478
.andExpect(jsonPath("$[0].parentId").value(null))
473479
.andExpect(jsonPath("$[0].security.default").value(ROLE_NONE))
474480
.andExpect(jsonPath("$[0].security.accessControlList[0].role").value(ROLE_ADMIN))
@@ -477,7 +483,6 @@ class RunnerControllerTests : ControllerTestBase() {
477483
.andExpect(jsonPath("$[1].name").value(secondRunnerName))
478484
.andExpect(jsonPath("$[1].createInfo.userId").value(PLATFORM_ADMIN_EMAIL))
479485
.andExpect(jsonPath("$[1].updateInfo.userId").value(PLATFORM_ADMIN_EMAIL))
480-
.andExpect(jsonPath("$[1].ownerName").value(secondOwnerName))
481486
.andExpect(jsonPath("$[1].parentId").value(null))
482487
.andExpect(jsonPath("$[1].security.default").value(ROLE_NONE))
483488
.andExpect(jsonPath("$[1].security.accessControlList[0].role").value(ROLE_ADMIN))

doc/Models/Runner.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
| **runTemplateId** | **String** | the Solution Run Template Id associated with this Runner | [default to null] |
1616
| **organizationId** | **String** | the associated Organization Id | [default to null] |
1717
| **workspaceId** | **String** | the associated Workspace Id | [default to null] |
18-
| **ownerName** | **String** | the name of the owner | [default to null] |
1918
| **solutionName** | **String** | the Solution name | [optional] [default to null] |
2019
| **runTemplateName** | **String** | the Solution Run Template name associated with this Runner | [optional] [default to null] |
20+
| **additionalData** | [**Map**](AnyType.md) | Free form additional data | [optional] [default to null] |
2121
| **datasets** | [**RunnerDatasets**](RunnerDatasets.md) | | [default to null] |
2222
| **runSizing** | [**RunnerResourceSizing**](RunnerResourceSizing.md) | | [optional] [default to null] |
2323
| **parametersValues** | [**List**](RunnerRunTemplateParameterValue.md) | the list of Solution Run Template parameters values | [default to null] |

doc/Models/RunnerCreateRequest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| **datasetList** | **List** | the list of Dataset Id associated to this Runner Run Template | [optional] [default to []] |
1313
| **runSizing** | [**RunnerResourceSizing**](RunnerResourceSizing.md) | | [optional] [default to null] |
1414
| **parametersValues** | [**List**](RunnerRunTemplateParameterValue.md) | the list of Solution Run Template parameters values | [optional] [default to []] |
15-
| **ownerName** | **String** | the name of the owner | [default to null] |
15+
| **additionalData** | [**Map**](AnyType.md) | Free form additional data | [optional] [default to null] |
1616
| **solutionName** | **String** | the Solution name | [optional] [default to null] |
1717
| **runTemplateName** | **String** | the Solution Run Template name associated with this Runner | [optional] [default to null] |
1818
| **security** | [**RunnerSecurity**](RunnerSecurity.md) | | [optional] [default to null] |

doc/Models/RunnerUpdateRequest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
| **datasetList** | **List** | the list of Dataset Id associated to this Runner Run Template | [optional] [default to null] |
1111
| **runSizing** | [**RunnerResourceSizing**](RunnerResourceSizing.md) | | [optional] [default to null] |
1212
| **parametersValues** | [**List**](RunnerRunTemplateParameterValue.md) | the list of Solution Run Template parameters values | [optional] [default to null] |
13-
| **ownerName** | **String** | the name of the owner | [optional] [default to null] |
13+
| **additionalData** | [**Map**](AnyType.md) | Free form additional data | [optional] [default to null] |
1414
| **solutionName** | **String** | the Solution name | [optional] [default to null] |
1515
| **runTemplateName** | **String** | the Solution Run Template name associated with this Runner | [optional] [default to null] |
1616

openapi/plantuml/schemas.plantuml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@ entity Runner {
368368
* runTemplateId: String
369369
* organizationId: String
370370
* workspaceId: String
371-
* ownerName: String
372371
solutionName: String
373372
runTemplateName: String
373+
additionalData: Map
374374
* datasets: RunnerDatasets
375375
runSizing: RunnerResourceSizing
376376
* parametersValues: List<RunnerRunTemplateParameterValue>
@@ -394,7 +394,7 @@ entity RunnerCreateRequest {
394394
datasetList: List<String>
395395
runSizing: RunnerResourceSizing
396396
parametersValues: List<RunnerRunTemplateParameterValue>
397-
* ownerName: String
397+
additionalData: Map
398398
solutionName: String
399399
runTemplateName: String
400400
security: RunnerSecurity
@@ -440,7 +440,7 @@ entity RunnerUpdateRequest {
440440
datasetList: List<String>
441441
runSizing: RunnerResourceSizing
442442
parametersValues: List<RunnerRunTemplateParameterValue>
443-
ownerName: String
443+
additionalData: Map
444444
solutionName: String
445445
runTemplateName: String
446446
}

run/src/integrationTest/kotlin/com/cosmotech/run/service/RunServiceIntegrationTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ class RunServiceIntegrationTest : CsmTestBase() {
217217
solutionId = solutionId,
218218
runTemplateId = runTemplateId,
219219
datasetList = datasetList,
220-
ownerName = "owner",
221220
security =
222221
RunnerSecurity(
223222
ROLE_NONE, mutableListOf(RunnerAccessControl(CONNECTED_ADMIN_USER, ROLE_ADMIN))))
@@ -243,7 +242,6 @@ class RunServiceIntegrationTest : CsmTestBase() {
243242
RunnerEditInfo(
244243
timestamp = Instant.now().toEpochMilli(),
245244
userId = getCurrentAccountIdentifier(csmPlatformProperties)),
246-
ownerName = "owner",
247245
datasets = RunnerDatasets(bases = mutableListOf(), parameter = ""),
248246
workspaceId = workspaceId,
249247
validationStatus = RunnerValidationStatus.Draft,

run/src/test/kotlin/com/cosmotech/run/ContainerFactoryTests.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ class ContainerFactoryTests {
203203
workspaceId = "workspace",
204204
createInfo = RunnerEditInfo(timestamp = Instant.now().toEpochMilli(), userId = "user"),
205205
updateInfo = RunnerEditInfo(timestamp = Instant.now().toEpochMilli(), userId = "user"),
206-
ownerName = "owner",
207206
parametersValues =
208207
mutableListOf(
209208
RunnerRunTemplateParameterValue(parameterId = "param1", value = "value1"),

0 commit comments

Comments
 (0)