mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-01 21:04:59 +01:00
9568e46f05
Co-authored-by: InsanePrawn <insane.prawny@gmail.com>
48 lines
927 B
Go
48 lines
927 B
Go
package tests
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/zrepl/zrepl/platformtest"
|
|
"github.com/zrepl/zrepl/zfs"
|
|
)
|
|
|
|
func IdempotentHold(ctx *platformtest.Context) {
|
|
|
|
platformtest.Run(ctx, platformtest.PanicErr, ctx.RootDataset, `
|
|
DESTROYROOT
|
|
CREATEROOT
|
|
+ "foo bar"
|
|
+ "foo bar@1"
|
|
`)
|
|
defer platformtest.Run(ctx, platformtest.PanicErr, ctx.RootDataset, `
|
|
R zfs release zrepl_platformtest "${ROOTDS}/foo bar@1"
|
|
- "foo bar@1"
|
|
- "foo bar"
|
|
`)
|
|
|
|
fs := fmt.Sprintf("%s/foo bar", ctx.RootDataset)
|
|
v1 := sendArgVersion(ctx, fs, "@1")
|
|
|
|
tag := "zrepl_platformtest"
|
|
err := zfs.ZFSHold(ctx, fs, v1, tag)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
err = zfs.ZFSHold(ctx, fs, v1, tag)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
vnonexistent := zfs.ZFSSendArgVersion{
|
|
RelName: "@nonexistent",
|
|
GUID: 0xbadf00d,
|
|
}
|
|
err = zfs.ZFSHold(ctx, fs, vnonexistent, tag)
|
|
if err == nil {
|
|
panic("still expecting error for nonexistent snapshot")
|
|
}
|
|
|
|
}
|