Skip to content
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
5 changes: 5 additions & 0 deletions pkg/snapshot/clonetree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ import (
"github.com/jaypipes/ghw/pkg/snapshot"
)

// NOTE: we intentionally use `os.RemoveAll` - not `snapshot.Cleanup` because we
// want to make sure we never leak directories. `snapshot.Cleanup` is used and
// tested explicitely in `unpack_test.go`.

// nolint: gocyclo
func TestCloneTree(t *testing.T) {
root, err := snapshot.Unpack(testDataSnapshot)
if err != nil {
t.Fatalf("Expected nil err, but got %v", err)
}
defer os.RemoveAll(root)

cloneRoot, err := ioutil.TempDir("", "ghw-test-clonetree-*")
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions pkg/snapshot/pack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
"github.com/jaypipes/ghw/pkg/snapshot"
)

// NOTE: we intentionally use `os.RemoveAll` - not `snapshot.Cleanup` because we
// want to make sure we never leak directories. `snapshot.Cleanup` is used and
// tested explicitely in `unpack_test.go`.

// nolint: gocyclo
func TestPackUnpack(t *testing.T) {
root, err := snapshot.Unpack(testDataSnapshot)
Expand Down Expand Up @@ -44,6 +48,7 @@ func TestPackUnpack(t *testing.T) {
if err != nil {
t.Fatalf("Expected nil err, but got %v", err)
}
defer os.RemoveAll(cloneRoot)

verifyTestData(t, cloneRoot)
}