Skip to content
Draft
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
3 changes: 3 additions & 0 deletions pkg/cmd/gpucreate/gpucreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,9 @@ func applyLaunchableWorkspaceRequest(cwOptions *store.CreateWorkspacesOptions, w
if wsReq.SubLocation != "" {
cwOptions.SubLocation = wsReq.SubLocation
}
if wsReq.ImageID != "" {
cwOptions.BaseImage = wsReq.ImageID
}

// Disk storage — the API may return a bare number (e.g., "256") or with
// a unit suffix (e.g., "256Gi"). The server's ParseDiskStorage expects a
Expand Down
4 changes: 4 additions & 0 deletions pkg/cmd/gpucreate/gpucreate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ func TestApplyLaunchableConfig(t *testing.T) { //nolint:funlen // test
Storage: "256",
Location: "us-west1",
SubLocation: "us-west1-b",
ImageID: "projects/example/global/images/custom-image",
FirewallRules: []store.CreateFirewallRule{
{Port: "8080", AllowedIPs: "all"},
{Port: "9000-9100", AllowedIPs: "all"},
Expand Down Expand Up @@ -340,6 +341,7 @@ func TestApplyLaunchableConfig(t *testing.T) { //nolint:funlen // test
// Location / sub-location
assert.Equal(t, "us-west1", cwOptions.Location)
assert.Equal(t, "us-west1-b", cwOptions.SubLocation)
assert.Equal(t, "projects/example/global/images/custom-image", cwOptions.BaseImage)
// Storage with Gi suffix
assert.Equal(t, "256Gi", cwOptions.DiskStorage)
// Build config
Expand Down Expand Up @@ -611,6 +613,7 @@ func TestLaunchableJSONWireFormat(t *testing.T) {
InstanceType: "n2-standard-4",
Location: "us-west1",
SubLocation: "us-west1-b",
ImageID: "projects/example/global/images/custom-image",
FirewallRules: []store.CreateFirewallRule{
{Port: "8080", AllowedIPs: "all"},
{Port: "22", AllowedIPs: "user-ip", ClientIPs: []string{"203.0.113.7/32"}},
Expand All @@ -627,6 +630,7 @@ func TestLaunchableJSONWireFormat(t *testing.T) {
s := string(body)

assert.Contains(t, s, `"subLocation":"us-west1-b"`)
assert.Contains(t, s, `"baseImage":"projects/example/global/images/custom-image"`)
assert.Contains(t, s, `"firewallRules":`)
assert.Contains(t, s, `"port":"8080"`)
assert.Contains(t, s, `"port":"22"`)
Expand Down