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

Commit4f26d38

Browse files
committed
Update workspace generator function name
This generates agent models, not workspaces. Renaming opens the way forgenerating random workspaces.
1 parentb69d8fa commit4f26d38

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

‎src/test/groovy/CoderCLIManagerTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ class CoderCLIManagerTest extends Specification {
413413
.replace("/tmp/coder-gateway/test.coder.invalid/coder-linux-amd64",CoderCLIManager.escape(ccm.localBinaryPath.toString()))
414414

415415
when:
416-
ccm.configSsh(workspaces.collect {DataGen.workspace(it) }, headerCommand)
416+
ccm.configSsh(workspaces.collect {DataGen.workspaceAgentModel(it) }, headerCommand)
417417

418418
then:
419419
sshConfigPath.toFile().text== expectedConf
@@ -473,7 +473,7 @@ class CoderCLIManagerTest extends Specification {
473473
def ccm=newCoderCLIManager(newURL("https://test.coder.invalid"), tmpdir)
474474

475475
when:
476-
ccm.configSsh(["foo","bar"].collect {DataGen.workspace(it) }, headerCommand)
476+
ccm.configSsh(["foo","bar"].collect {DataGen.workspaceAgentModel(it) }, headerCommand)
477477

478478
then:
479479
thrown(Exception)

‎src/test/groovy/CoderWorkspacesStepViewTest.groovy

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,46 @@ class CoderWorkspacesStepViewTest extends Specification {
99
def table=newWorkspacesTable()
1010
table.listTableModel.items=List.of(
1111
// An off workspace.
12-
DataGen.workspace("ws1","ws1"),
12+
DataGen.workspaceAgentModel("ws1","ws1"),
1313

1414
// On workspaces.
15-
DataGen.workspace("agent1","ws2"),
16-
DataGen.workspace("agent2","ws2"),
17-
DataGen.workspace("agent3","ws3"),
15+
DataGen.workspaceAgentModel("agent1","ws2"),
16+
DataGen.workspaceAgentModel("agent2","ws2"),
17+
DataGen.workspaceAgentModel("agent3","ws3"),
1818

1919
// Another off workspace.
20-
DataGen.workspace("ws4","ws4"),
20+
DataGen.workspaceAgentModel("ws4","ws4"),
2121

2222
// In practice we do not list both agents and workspaces
2323
// together but here test that anyway with an agent first and
2424
// then with a workspace first.
25-
DataGen.workspace("agent2","ws5"),
26-
DataGen.workspace("ws5","ws5"),
27-
DataGen.workspace("ws6","ws6"),
28-
DataGen.workspace("agent3","ws6"),
25+
DataGen.workspaceAgentModel("agent2","ws5"),
26+
DataGen.workspaceAgentModel("ws5","ws5"),
27+
DataGen.workspaceAgentModel("ws6","ws6"),
28+
DataGen.workspaceAgentModel("agent3","ws6"),
2929
)
3030

3131
expect:
3232
table.getNewSelection(selected)== expected
3333

3434
where:
35-
selected | expected
36-
null |-1// No selection.
37-
DataGen.workspace("gone","gone") |-1// No workspace that matches.
38-
DataGen.workspace("ws1","ws1") |0// Workspace exact match.
39-
DataGen.workspace("gone","ws1") |0// Agent gone, select workspace.
40-
DataGen.workspace("ws2","ws2") |1// Workspace gone, select first agent.
41-
DataGen.workspace("agent1","ws2") |1// Agent exact match.
42-
DataGen.workspace("agent2","ws2") |2// Agent exact match.
43-
DataGen.workspace("ws3","ws3") |3// Workspace gone, select first agent.
44-
DataGen.workspace("agent3","ws3") |3// Agent exact match.
45-
DataGen.workspace("gone","ws4") |4// Agent gone, select workspace.
46-
DataGen.workspace("ws4","ws4") |4// Workspace exact match.
47-
DataGen.workspace("agent2","ws5") |5// Agent exact match.
48-
DataGen.workspace("gone","ws5") |5// Agent gone, another agent comes first.
49-
DataGen.workspace("ws5","ws5") |6// Workspace exact match.
50-
DataGen.workspace("ws6","ws6") |7// Workspace exact match.
51-
DataGen.workspace("gone","ws6") |7// Agent gone, workspace comes first.
52-
DataGen.workspace("agent3","ws6") |8// Agent exact match.
35+
selected| expected
36+
null|-1// No selection.
37+
DataGen.workspaceAgentModel("gone","gone") |-1// No workspace that matches.
38+
DataGen.workspaceAgentModel("ws1","ws1") |0// Workspace exact match.
39+
DataGen.workspaceAgentModel("gone","ws1") |0// Agent gone, select workspace.
40+
DataGen.workspaceAgentModel("ws2","ws2") |1// Workspace gone, select first agent.
41+
DataGen.workspaceAgentModel("agent1","ws2") |1// Agent exact match.
42+
DataGen.workspaceAgentModel("agent2","ws2") |2// Agent exact match.
43+
DataGen.workspaceAgentModel("ws3","ws3") |3// Workspace gone, select first agent.
44+
DataGen.workspaceAgentModel("agent3","ws3") |3// Agent exact match.
45+
DataGen.workspaceAgentModel("gone","ws4") |4// Agent gone, select workspace.
46+
DataGen.workspaceAgentModel("ws4","ws4") |4// Workspace exact match.
47+
DataGen.workspaceAgentModel("agent2","ws5") |5// Agent exact match.
48+
DataGen.workspaceAgentModel("gone","ws5") |5// Agent gone, another agent comes first.
49+
DataGen.workspaceAgentModel("ws5","ws5") |6// Workspace exact match.
50+
DataGen.workspaceAgentModel("ws6","ws6") |7// Workspace exact match.
51+
DataGen.workspaceAgentModel("gone","ws6") |7// Agent gone, workspace comes first.
52+
DataGen.workspaceAgentModel("agent3","ws6") |8// Agent exact match.
5353
}
5454
}

‎src/test/groovy/DataGen.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class DataGen {
1212
// toAgentModels() on it. Also the way an "agent" model can have no
1313
// agent in it seems weird; can we refactor to remove
1414
// WorkspaceAgentModel and use the original structs from the API?
15-
staticWorkspaceAgentModelworkspace(Stringname,StringworkspaceName="",UUIDagentId=UUID.randomUUID()) {
15+
staticWorkspaceAgentModelworkspaceAgentModel(Stringname,StringworkspaceName="",UUIDagentId=UUID.randomUUID()) {
1616
returnnewWorkspaceAgentModel(
1717
workspaceName==""?null: agentId,
1818
UUID.randomUUID(),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp