Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gofumpt and update status badges #75

Merged
merged 3 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# [containerd](https://github.com/containerd/containerd) ZFS snapshotter plugin

[![Build Status](https://github.com/containerd/zfs/workflows/CI/badge.svg)](https://github.com/containerd/zfs/actions?query=workflow%3ACI)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/containerd/zfs)](https://pkg.go.dev/github.com/containerd/zfs)
[![Build Status](https://github.com/containerd/zfs/actions/workflows/ci.yml/badge.svg)](https://github.com/containerd/zfs/actions/workflows/ci.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/zfs)](https://goreportcard.com/report/github.com/containerd/zfs)
[![codecov](https://codecov.io/gh/containerd/zfs/branch/main/graph/badge.svg)](https://codecov.io/gh/containerd/zfs)

ZFS snapshotter plugin for containerd.
Expand Down
9 changes: 3 additions & 6 deletions zfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@ func NewSnapshotter(root string) (snapshots.Snapshotter, error) {
return b, nil
}

var (
zfsCreateProperties = map[string]string{
"mountpoint": "legacy",
}
)
var zfsCreateProperties = map[string]string{
"mountpoint": "legacy",
}

// createFilesystem creates but not mount.
func createFilesystem(datasetName string) (*zfs.Dataset, error) {
Expand Down Expand Up @@ -138,7 +136,6 @@ func (z *snapshotter) usage(ctx context.Context, key string) (snapshots.Usage, e
if info.Kind == snapshots.KindActive {
activeName := filepath.Join(z.dataset.Name, id)
sDataset, err := zfs.GetDataset(activeName)

if err != nil {
return snapshots.Usage{}, err
}
Expand Down
10 changes: 3 additions & 7 deletions zfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ func TestZFSUsage(t *testing.T) {
ctx := context.Background()

// Create temporary directory
root, err := os.MkdirTemp("", "TestZFSUsage-")
if err != nil {
t.Error(err)
}
defer os.RemoveAll(root)
root := t.TempDir()

// Create the snapshotter
z, closer, err := newSnapshotter()(ctx, root)
Expand Down Expand Up @@ -142,7 +138,7 @@ func TestZFSUsage(t *testing.T) {
)

// Create a child layer with a 1MB file
baseApplier := fstest.Apply(fstest.CreateRandomFile("/a", 12345679, oneMB, 0777))
baseApplier := fstest.Apply(fstest.CreateRandomFile("/a", 12345679, oneMB, 0o777))

target = filepath.Join(root, "prepare-2")
mounts, err := z.Prepare(ctx, target, filepath.Join(root, "layer-1"))
Expand Down Expand Up @@ -172,7 +168,7 @@ func TestZFSUsage(t *testing.T) {
}

// Create another child layer with a 2MB file
baseApplier = fstest.Apply(fstest.CreateRandomFile("/b", 12345679, twoMB, 0777))
baseApplier = fstest.Apply(fstest.CreateRandomFile("/b", 12345679, twoMB, 0o777))

target = filepath.Join(root, "prepare-3")
mounts, err = z.Prepare(ctx, target, filepath.Join(root, "layer-2"))
Expand Down