diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-07-18 13:25:28 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-07-22 14:49:22 +0000 |
| commit | 6ce0983056e7e9efff04681de67e6310b88fdc16 (patch) | |
| tree | ccaa5d515f42645bc9cb9b3366c28533b6ba9b89 /pkg/osutil/tar_test.go | |
| parent | 055e9354ef02e1231d7e2c369f57baf59b98011d (diff) | |
pkg/manager: add a test for PatchFocusAreas
For that, make a part of the tar_test.go reusable.
Diffstat (limited to 'pkg/osutil/tar_test.go')
| -rw-r--r-- | pkg/osutil/tar_test.go | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/pkg/osutil/tar_test.go b/pkg/osutil/tar_test.go index a0e5a22bd..432d7c622 100644 --- a/pkg/osutil/tar_test.go +++ b/pkg/osutil/tar_test.go @@ -7,31 +7,20 @@ import ( "archive/tar" "bytes" "io" - "path/filepath" "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestTarDirectory(t *testing.T) { dir := t.TempDir() - items := map[string]string{ "file1.txt": "first file content", "dir/file2.txt": "second file content", "empty.txt": "", } - - for path, content := range items { - fullPath := filepath.Join(dir, path) - dirPath := filepath.Dir(fullPath) - if err := MkdirAll(dirPath); err != nil { - t.Fatalf("mkdir %q failed: %v", dirPath, err) - } - if err := WriteFile(fullPath, []byte(content)); err != nil { - t.Fatalf("write file failed: %v", err) - } - } + require.NoError(t, FillDirectory(dir, items)) var buf bytes.Buffer err := tarDirectory(dir, &buf) |
