66
77 "github.com/databricks/databricks-sdk-go/service/compute"
88 "github.com/stretchr/testify/assert"
9+ "github.com/stretchr/testify/require"
910)
1011
1112func TestBuildSSHServerSubmitRun (t * testing.T ) {
@@ -18,7 +19,7 @@ func TestBuildSSHServerSubmitRun(t *testing.T) {
1819 ServerTimeout : time .Hour ,
1920 EnvironmentVersion : 4 ,
2021 }
21- got := buildSSHServerSubmitRun ("v1" , "scope" , notebookPath , opts )
22+ got := buildSSHServerSubmitRun ("v1" , "scope" , notebookPath , "" , opts )
2223
2324 // Usage policy flows onto the run and into the base params the server reads.
2425 assert .Equal (t , "pol-1" , got .BudgetPolicyId )
@@ -38,17 +39,32 @@ func TestBuildSSHServerSubmitRun(t *testing.T) {
3839 Accelerator : "GPU_1xA10" ,
3940 ServerTimeout : time .Hour ,
4041 }
41- got := buildSSHServerSubmitRun ("v1" , "scope" , notebookPath , opts )
42+ got := buildSSHServerSubmitRun ("v1" , "scope" , notebookPath , "" , opts )
4243
4344 assert .Equal (t , compute .HardwareAcceleratorType ("GPU_1xA10" ), got .Tasks [0 ].Compute .HardwareAccelerator )
4445 })
4546
47+ t .Run ("serverless with base environment" , func (t * testing.T ) {
48+ opts := ClientOptions {
49+ ConnectionName : "conn" ,
50+ ServerTimeout : time .Hour ,
51+ EnvironmentVersion : 4 ,
52+ BaseEnvironment : "my-env" ,
53+ }
54+ got := buildSSHServerSubmitRun ("v1" , "scope" , notebookPath , "workspace-base-environments/dbe_123" , opts )
55+
56+ // A resolved base environment carries its own version, so environment_version is not set.
57+ require .Len (t , got .Environments , 1 )
58+ assert .Equal (t , "workspace-base-environments/dbe_123" , got .Environments [0 ].Spec .BaseEnvironment )
59+ assert .Empty (t , got .Environments [0 ].Spec .EnvironmentVersion )
60+ })
61+
4662 t .Run ("dedicated cluster" , func (t * testing.T ) {
4763 opts := ClientOptions {
4864 ClusterID : "abc-123" ,
4965 ServerTimeout : time .Hour ,
5066 }
51- got := buildSSHServerSubmitRun ("v1" , "scope" , notebookPath , opts )
67+ got := buildSSHServerSubmitRun ("v1" , "scope" , notebookPath , "" , opts )
5268
5369 // Usage policy is serverless-only; a dedicated run carries none and targets the cluster.
5470 assert .Empty (t , got .BudgetPolicyId )
0 commit comments