@@ -108,6 +108,8 @@ defaultLocation: US
108108defaultNotebookRuntimeOptions:
109109 outputBucket: gs://some-bucket
110110 runtimeTemplateName: projects/test-project/locations/us-central1/notebookRuntimeTemplates/test-template
111+ repositorySnapshotDestination:
112+ repositorySnapshotUri: gs://some-other-bucket
111113 ` ) ;
112114 fs . writeFileSync ( path . join ( projectDir , "definitions/notebook.ipynb" ) , EMPTY_NOTEBOOK_CONTENTS ) ;
113115
@@ -120,12 +122,59 @@ defaultNotebookRuntimeOptions:
120122 defaultNotebookRuntimeOptions : {
121123 outputBucket : "gs://some-bucket" ,
122124 runtimeTemplateName :
123- "projects/test-project/locations/us-central1/notebookRuntimeTemplates/test-template"
125+ "projects/test-project/locations/us-central1/notebookRuntimeTemplates/test-template" ,
126+ repositorySnapshotDestination : {
127+ repositorySnapshotUri : "gs://some-other-bucket"
128+ }
129+ } ,
130+ warehouse : "bigquery"
131+ } ) ;
132+ } ) ;
133+
134+ test ( `notebook default runtime options snapshot destination defaults to output bucket` , ( ) => {
135+ const projectDir = createSimpleNotebookProject ( `
136+ defaultProject: dataform
137+ defaultLocation: US
138+ defaultNotebookRuntimeOptions:
139+ outputBucket: gs://some-bucket
140+ runtimeTemplateName: projects/test-project/locations/us-central1/notebookRuntimeTemplates/test-template
141+ repositorySnapshotDestination: {}
142+ ` ) ;
143+ fs . writeFileSync ( path . join ( projectDir , "definitions/notebook.ipynb" ) , EMPTY_NOTEBOOK_CONTENTS ) ;
144+
145+ const result = runMainInVm ( coreExecutionRequestFromPath ( projectDir ) ) ;
146+
147+ expect ( result . compile . compiledGraph . graphErrors . compilationErrors ) . deep . equals ( [ ] ) ;
148+ expect ( asPlainObject ( result . compile . compiledGraph . projectConfig ) ) . deep . equals ( {
149+ defaultDatabase : "dataform" ,
150+ defaultLocation : "US" ,
151+ defaultNotebookRuntimeOptions : {
152+ outputBucket : "gs://some-bucket" ,
153+ runtimeTemplateName :
154+ "projects/test-project/locations/us-central1/notebookRuntimeTemplates/test-template" ,
155+ repositorySnapshotDestination : {
156+ repositorySnapshotUri : "gs://some-bucket"
157+ }
124158 } ,
125159 warehouse : "bigquery"
126160 } ) ;
127161 } ) ;
128162
163+ test ( `notebook default runtime options throw for snapshot destination with no uri or output bucket` , ( ) => {
164+ const projectDir = createSimpleNotebookProject ( `
165+ defaultProject: dataform
166+ defaultLocation: US
167+ defaultNotebookRuntimeOptions:
168+ runtimeTemplateName: projects/test-project/locations/us-central1/notebookRuntimeTemplates/test-template
169+ repositorySnapshotDestination: {}
170+ ` ) ;
171+ fs . writeFileSync ( path . join ( projectDir , "definitions/notebook.ipynb" ) , EMPTY_NOTEBOOK_CONTENTS ) ;
172+
173+ expect ( ( ) => runMainInVm ( coreExecutionRequestFromPath ( projectDir ) ) ) . to . throw (
174+ "Invalid repository_snapshot_destination: either repository_snapshot_uri or output_bucket has to be defined"
175+ ) ;
176+ } ) ;
177+
129178 suite ( "sqlx and JS API config options" , ( ) => {
130179 test ( `for notebooks` , ( ) => {
131180 const projectDir = tmpDirFixture . createNewTmpDir ( ) ;
0 commit comments