@@ -151,22 +151,46 @@ test('diskCan', () => {
151151 expect ( diskCan . delete ( { state : { state : 'attached' , instance : 'xyz' } } ) ) . toBe ( false )
152152 expect ( diskCan . delete ( { state : { state : 'detached' } } ) ) . toBe ( true )
153153
154- // snapshot requires distributed disk type
155- expect ( diskCan . snapshot ( { state : { state : 'detached' } , diskType : 'distributed' } ) ) . toBe (
156- true
157- )
154+ // snapshot requires distributed, non-read-only disk type
155+ expect (
156+ diskCan . snapshot ( {
157+ state : { state : 'detached' } ,
158+ diskType : 'distributed' ,
159+ readOnly : false ,
160+ } )
161+ ) . toBe ( true )
158162 expect (
159163 diskCan . snapshot ( {
160164 state : { state : 'attached' , instance : 'x' } ,
161165 diskType : 'distributed' ,
166+ readOnly : false ,
162167 } )
163168 ) . toBe ( true )
164- expect ( diskCan . snapshot ( { state : { state : 'creating' } , diskType : 'distributed' } ) ) . toBe (
165- false
166- )
167- expect ( diskCan . snapshot ( { state : { state : 'detached' } , diskType : 'local' } ) ) . toBe ( false )
168169 expect (
169- diskCan . snapshot ( { state : { state : 'attached' , instance : 'x' } , diskType : 'local' } )
170+ diskCan . snapshot ( {
171+ state : { state : 'creating' } ,
172+ diskType : 'distributed' ,
173+ readOnly : false ,
174+ } )
175+ ) . toBe ( false )
176+ expect (
177+ diskCan . snapshot ( { state : { state : 'detached' } , diskType : 'local' , readOnly : false } )
178+ ) . toBe ( false )
179+ expect (
180+ diskCan . snapshot ( {
181+ state : { state : 'attached' , instance : 'x' } ,
182+ diskType : 'local' ,
183+ readOnly : false ,
184+ } )
185+ ) . toBe ( false )
186+
187+ // read-only disks cannot be snapshotted
188+ expect (
189+ diskCan . snapshot ( {
190+ state : { state : 'detached' } ,
191+ diskType : 'distributed' ,
192+ readOnly : true ,
193+ } )
170194 ) . toBe ( false )
171195
172196 // @ts -expect-error typechecker rejects actions that don't exist
0 commit comments