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

fix(initrd): Remove the rootfs directly from the testdata directory #2066

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
10 changes: 8 additions & 2 deletions initrd/directory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ import (
"os"
"testing"

"kraftkit.sh/archive"
"kraftkit.sh/cpio"
"kraftkit.sh/initrd"
)

func TestNewFromDirectory(t *testing.T) {
const rootDir = "testdata/rootfs"
if err := archive.Unarchive("testdata/rootfs.tar.gz", "testdata/rootfs"); err != nil {
t.Fatal("Unarchive:", err)
}

ctx := context.Background()

ird, err := initrd.NewFromDirectory(ctx, rootDir)
ird, err := initrd.NewFromDirectory(ctx, "testdata/rootfs")
if err != nil {
t.Fatal("NewFromDirectory:", err)
}
Expand All @@ -32,6 +35,9 @@ func TestNewFromDirectory(t *testing.T) {
if err := os.Remove(irdPath); err != nil {
t.Fatal("Failed to remove initrd file:", err)
}
if err := os.RemoveAll("testdata/rootfs"); err != nil {
t.Fatal("Failed to remove rootfs directory:", err)
}
})

r := cpio.NewReader(openFile(t, irdPath))
Expand Down
1 change: 0 additions & 1 deletion initrd/testdata/rootfs/a/b/c/d

This file was deleted.

1 change: 0 additions & 1 deletion initrd/testdata/rootfs/a/b/c/e-symlink

This file was deleted.

1 change: 0 additions & 1 deletion initrd/testdata/rootfs/a/b/c/f-hardlink

This file was deleted.

1 change: 0 additions & 1 deletion initrd/testdata/rootfs/a/b/c/g-recursive-symlink

This file was deleted.

Loading