[functional-tests] Check *_restore doesn't touch the metadata if the xml doesn't exists, or isn't xml.

This commit is contained in:
Joe Thornber
2017-09-28 14:36:01 +01:00
parent 7796b4eecb
commit f018e6ecf7
5 changed files with 51 additions and 4 deletions

View File

@ -136,6 +136,20 @@
(receive (_ stderr) (run-fail "era_restore" "-o" md)
(assert-starts-with "No input file provided." stderr))))
(define-scenario (era-restore missing-input-file)
"the input file can't be found"
(with-empty-metadata (md)
(receive (_ stderr) (run-fail "era_restore -i no-such-file -o" md)
(assert-superblock-untouched md)
(assert-starts-with "Couldn't stat file" stderr))))
(define-scenario (era-restore garbage-input-file)
"the input file is just zeroes"
(with-empty-metadata (md)
(with-temp-file-sized ((xml "era.xml" 4096))
(receive (_ stderr) (run-fail "era_restore -i " xml "-o" md)
(assert-superblock-untouched md)))))
(define-scenario (era-restore output-unspecified)
"Fails if no metadata dev specified"
(with-era-xml (xml)