Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb69d8fa

Browse files
committed
Fix DataGen not quite mirroring toAgentModels()
It should omit agent information when the workspace specifies no agentsand the name should combine the workspace and agent names.
1 parentc8e503e commitb69d8fa

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

‎src/main/kotlin/com/coder/gateway/models/WorkspaceAgentModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ data class WorkspaceAgentModel(
1717
valagentID:UUID?,
1818
valworkspaceID:UUID,
1919
valworkspaceName:String,
20-
valname:String,// Name of the workspace ORtheagent if this is for an agent.
20+
valname:String,// Name of the workspace ORworkspace.agent if this is for an agent.
2121
valtemplateID:UUID,
2222
valtemplateName:String,
2323
valtemplateIconPath:String,

‎src/test/groovy/DataGen.groovy

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@ import com.coder.gateway.sdk.v2.models.WorkspaceStatus
55
importcom.coder.gateway.sdk.v2.models.WorkspaceTransition
66

77
classDataGen {
8-
staticWorkspaceAgentModelworkspace(Stringname,StringworkspaceName= name) {
8+
// Create a random workspace agent model. If the workspace name is omitted
9+
// then return a model without any agent bits, similar to what
10+
// toAgentModels() does if the workspace does not specify any agents.
11+
// TODO: Maybe better to randomly generate the workspace and then call
12+
// toAgentModels() on it. Also the way an "agent" model can have no
13+
// agent in it seems weird; can we refactor to remove
14+
// WorkspaceAgentModel and use the original structs from the API?
15+
staticWorkspaceAgentModelworkspace(Stringname,StringworkspaceName="",UUIDagentId=UUID.randomUUID()) {
916
returnnewWorkspaceAgentModel(
17+
workspaceName==""?null: agentId,
1018
UUID.randomUUID(),
11-
UUID.randomUUID(),
12-
workspaceName,
13-
name,
19+
workspaceName==""? name: workspaceName,
20+
workspaceName==""? name: (workspaceName+"."+ name),
1421
UUID.randomUUID(),
1522
"template-name",
1623
"template-icon-path",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp