zfs: parse GUID

This commit is contained in:
Sam Hoffman
2026-01-31 01:18:50 -05:00
parent b39d8d2d06
commit 297c499bba
3 changed files with 106 additions and 1 deletions

View File

@@ -2,8 +2,12 @@ package zfs_test
import (
"fmt"
"os"
"os/exec"
"testing"
"git.gentoo.party/sam/thanks/internal/zfs"
"github.com/stretchr/testify/assert"
)
type zfscmd struct {
@@ -43,3 +47,14 @@ func Test_ZFSCommand(t *testing.T) {
t.Errorf("SSH zrunner failed: %s \n\n%s", err.Error(), out)
}
}
func Test_Snapshots(t *testing.T) {
f, err := os.Open("./zfs-list_snapshot.txt")
assert.Nil(t, err, "failed to open test data")
out, err := zfs.ParseSnapshots(f)
assert.Nil(t, err, "ParseSnapshots returned non-nil error")
for _, snap := range out {
assert.Contains(t, snap.SnapshotName, "thanks")
}
}