Skip to content

Commit b418ac5

Browse files
committed
fix: UTs should include build id and build number
1 parent a3651ba commit b418ac5

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/test/kotlin/com/coder/toolbox/sdk/DataGen.kt

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import com.coder.toolbox.sdk.v2.models.WorkspaceStatus
1212
import com.coder.toolbox.util.Arch
1313
import com.coder.toolbox.util.OS
1414
import java.util.UUID
15+
import kotlin.random.Random
1516

1617
class DataGen {
1718
companion object {
@@ -20,19 +21,19 @@ class DataGen {
2021
agentId: String,
2122
): WorkspaceResource = WorkspaceResource(
2223
agents =
23-
listOf(
24-
WorkspaceAgent(
25-
id = UUID.fromString(agentId),
26-
status = WorkspaceAgentStatus.CONNECTED,
27-
name = agentName,
28-
architecture = Arch.from("amd64"),
29-
operatingSystem = OS.from("linux"),
30-
directory = null,
31-
expandedDirectory = null,
32-
lifecycleState = WorkspaceAgentLifecycleState.READY,
33-
loginBeforeReady = false,
24+
listOf(
25+
WorkspaceAgent(
26+
id = UUID.fromString(agentId),
27+
status = WorkspaceAgentStatus.CONNECTED,
28+
name = agentName,
29+
architecture = Arch.from("amd64"),
30+
operatingSystem = OS.from("linux"),
31+
directory = null,
32+
expandedDirectory = null,
33+
lifecycleState = WorkspaceAgentLifecycleState.READY,
34+
loginBeforeReady = false,
35+
),
3436
),
35-
),
3637
)
3738

3839
fun workspace(
@@ -48,9 +49,9 @@ class DataGen {
4849
templateDisplayName = "template-display-name",
4950
templateIcon = "template-icon",
5051
latestBuild =
51-
build(
52-
resources = agents.map { resource(it.key, it.value) },
53-
),
52+
build(
53+
resources = agents.map { resource(it.key, it.value) },
54+
),
5455
outdated = false,
5556
name = name,
5657
ownerName = "owner",
@@ -61,6 +62,8 @@ class DataGen {
6162
templateVersionID: UUID = UUID.randomUUID(),
6263
resources: List<WorkspaceResource> = emptyList(),
6364
): WorkspaceBuild = WorkspaceBuild(
65+
id = UUID.randomUUID(),
66+
buildNumber = Random.nextInt(),
6467
templateVersionID = templateVersionID,
6568
resources = resources,
6669
status = WorkspaceStatus.RUNNING,

0 commit comments

Comments
 (0)