Skip to content

Commit 8f8ef93

Browse files
author
David Scott
committed
test: verify that xenvm lvextend prints a nice error message if out of space
This test currently fails. Signed-off-by: David Scott <[email protected]>
1 parent 615538f commit 8f8ef93

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/test.ml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,30 @@ let lvcreate_toobig =
129129
| _ ->
130130
failwith "Expected exit code 5"
131131

132+
let lvextend_toobig =
133+
"lvextend packer-virtualbox-iso-vg/swap_1 -L 1T: check that the failure is nice" >::
134+
fun () ->
135+
xenvm [ "lvcreate"; "-n"; "test"; "-l"; "100%F"; vg ] |> ignore_string;
136+
begin
137+
Lwt_main.run (
138+
Lwt.catch
139+
(fun () -> Client.resize "test" xib)
140+
(function Xenvm_interface.Insufficient_free_space(needed, available) -> return ()
141+
| e -> failwith (Printf.sprintf "Did not get Insufficient_free_space: %s" (Printexc.to_string e)))
142+
);
143+
try
144+
xenvm [ "lvextend"; vg ^ "/test"; "-L"; Int64.to_string xib ] |> ignore_string;
145+
failwith "Did not get Insufficient_free_space"
146+
with
147+
| Bad_exit(5, _, _, stdout, stderr) ->
148+
let expected = "Insufficient free space" in
149+
if not (contains stderr expected)
150+
then failwith (Printf.sprintf "stderr [%s] did not have expected string [%s]" stderr expected)
151+
| e ->
152+
failwith (Printf.sprintf "Expected exit code 5: %s" (Printexc.to_string e))
153+
end;
154+
xenvm [ "lvremove"; vg ^ "/test" ] |> ignore_string
155+
132156
let file_exists filename =
133157
try
134158
Unix.LargeFile.stat filename |> ignore;
@@ -188,6 +212,7 @@ let xenvmd_suite = "Commands which require xenvmd" >::: [
188212
lvcreate_percent;
189213
lvcreate_toobig;
190214
lvchange_n;
215+
lvextend_toobig;
191216
vgs_online;
192217
]
193218

0 commit comments

Comments
 (0)