Skip to content

Commit

Permalink
fix(initrd): Remove the rootfs directly from the testdata directory (#…
Browse files Browse the repository at this point in the history
…2066)

Reviewed-by: Cezar Craciunoiu <[email protected]>
Approved-by: Cezar Craciunoiu <[email protected]>
  • Loading branch information
craciunoiuc authored Jan 13, 2025
2 parents 396dfdf + 75d18dd commit 7faf749
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
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.

0 comments on commit 7faf749

Please sign in to comment.