platformtest: dedicated pool per test, Makefile target, maintainer notice

fixes #216
fixes #211
This commit is contained in:
Christian Schwarz
2019-09-29 18:44:59 +02:00
parent 215848f476
commit 58ab25919e
8 changed files with 161 additions and 41 deletions
+1 -16
View File
@@ -37,26 +37,11 @@ type DestroyRootOp struct {
}
func (o *DestroyRootOp) Run(ctx context.Context, e Execer) error {
const magicName = "zreplplayground"
// sanity check: root must contain
if !strings.Contains(o.Path, magicName) {
panic("sanity check failed")
}
// early-exit if it doesn't exist
if err := e.RunExpectSuccessNoOutput(ctx, "zfs", "get", "-H", "name", o.Path); err != nil {
getLog(ctx).WithField("root_ds", o.Path).Info("assume root ds doesn't exist")
return nil
}
op, err := exec.CommandContext(ctx, "zfs", "destroy", "-nvrp", o.Path).CombinedOutput()
if err != nil {
return fmt.Errorf("cannot clean root dataset %q: %s\n%s", o.Path, err, op)
}
sc := bufio.NewScanner(bytes.NewReader(op))
for sc.Scan() {
if !strings.Contains(sc.Text(), magicName) {
panic("sanity check failed")
}
}
return e.RunExpectSuccessNoOutput(ctx, "zfs", "destroy", "-r", o.Path)
}
@@ -141,7 +126,7 @@ func Run(ctx context.Context, rk RunKind, rootds string, stmtsStr string) {
if err != nil {
panic(err)
}
execer := newEx(getLog(ctx))
execer := NewEx(getLog(ctx))
for _, s := range stmt {
err := s.Run(ctx, execer)
if err == nil {