[functional-tests] ditch define-thin-scenario

It obfuscates more than it saves
This commit is contained in:
Joe Thornber 2017-12-14 15:12:09 +00:00
parent 2db8ecf9e9
commit 4b90bd8edb

View File

@ -196,15 +196,6 @@
(define (default-data-table size) (define (default-data-table size)
(list ((mk-slow-allocator) size))) (list ((mk-slow-allocator) size)))
(define-syntax define-thin-scenario
(syntax-rules ()
((_ path (pool size) desc b1 b2 ...)
(define-dm-scenario path desc
(with-pool-fn (list ((mk-fast-allocator) (meg 32)))
(list ((mk-slow-allocator) size))
(kilo 64)
(lambda (pool) b1 b2 ...))))))
(define (thin-table pool id size) (define (thin-table pool id size)
(list (list
(make-target (to-sectors size) "thin" (build-args-string (dm-device-path pool) id)))) (make-target (to-sectors size) "thin" (build-args-string (dm-device-path pool) id))))
@ -449,47 +440,54 @@
;;;----------------------------------------------------------- ;;;-----------------------------------------------------------
;;; Thin scenarios ;;; Thin scenarios
;;;----------------------------------------------------------- ;;;-----------------------------------------------------------
(define-thin-scenario (thin create-pool) (pool (gig 10)) (define-dm-scenario (thin create-pool)
"create a pool" "create a pool"
#t) (with-default-pool (pool)
#t))
(define-thin-scenario (thin create-thin) (pool (gig 10)) (define-dm-scenario (thin create-thin)
"create a thin volume larger than the pool" "create a thin volume larger than the pool"
(with-new-thin (thin pool 0 (gig 100)) (with-default-pool (pool)
#t)) (with-new-thin (thin pool 0 (gig 100))
#t)))
(define-thin-scenario (thin zero-thin) (pool (gig 10)) (define-dm-scenario (thin zero-thin)
"zero a 1 gig thin device" "zero a 1 gig thin device"
(let ((thin-size (gig 1))) (with-default-pool (pool)
(with-new-thin (thin pool 0 thin-size) (let ((thin-size (gig 1)))
(zero-dev thin thin-size)))) (with-new-thin (thin pool 0 thin-size)
(zero-dev thin thin-size)))))
;;;----------------------------------------------------------- ;;;-----------------------------------------------------------
;;; Thin creation scenarios ;;; Thin creation scenarios
;;;----------------------------------------------------------- ;;;-----------------------------------------------------------
(define-thin-scenario (thin create lots-of-thins) (pool (gig 10)) (define-dm-scenario (thin create lots-of-thins)
"create lots of empty thin volumes" "create lots of empty thin volumes"
(upto (n 1000) (create-thin pool n))) (with-default-pool (pool)
(upto (n 1000) (create-thin pool n))))
(define-thin-scenario (thin create lots-of-snaps) (pool (gig 10)) (define-dm-scenario (thin create lots-of-snaps)
"create lots of snapshots of a single volume" "create lots of snapshots of a single volume"
(create-thin pool 0) (with-default-pool (pool)
(upto (n 999) (create-thin pool 0)
(create-snap pool (+ n 1) 0))) (upto (n 999)
(create-snap pool (+ n 1) 0))))
(define-thin-scenario (thin create lots-of-recursive-snaps) (pool (gig 10)) (define-dm-scenario (thin create lots-of-recursive-snaps)
"create lots of recursive snapshots" "create lots of recursive snapshots"
(create-thin pool 0) (with-default-pool (pool)
(upto (n 999) (create-thin pool 0)
(create-snap pool (+ n 1) n))) (upto (n 999)
(create-snap pool (+ n 1) n))))
(define-thin-scenario (thin create activate-thin-while-pool-suspended-fails) (pool (gig 10)) (define-dm-scenario (thin create activate-thin-while-pool-suspended-fails)
"you can't activate a thin device while the pool is suspended" "you can't activate a thin device while the pool is suspended"
(create-thin pool 0) (with-default-pool (pool)
(pause-device pool (create-thin pool 0)
(assert-raises (pause-device pool
(with-thin (thin pool 0 (gig 1)) (assert-raises
(fail "activate shouldn't work"))))) (with-thin (thin pool 0 (gig 1))
#t)))))
(define-dm-scenario (thin create huge-block-size) (define-dm-scenario (thin create huge-block-size)
"huge block sizes are possible" "huge block sizes are possible"