TestPrefixHeaderReadable tests that files that could be created with the version of this package that was built with <=go17 are still readable.
(t *testing.T)
| 31 | // TestPrefixHeaderReadable tests that files that could be created with the |
| 32 | // version of this package that was built with <=go17 are still readable. |
| 33 | func TestPrefixHeaderReadable(t *testing.T) { |
| 34 | testutil.RequiresRoot(t) |
| 35 | |
| 36 | // https://gist.github.com/stevvooe/e2a790ad4e97425896206c0816e1a882#file-out-go |
| 37 | var testFile = []byte("\x1f\x8b\x08\x08\x44\x21\x68\x59\x00\x03\x74\x2e\x74\x61\x72\x00\x4b\xcb\xcf\x67\xa0\x35\x30\x80\x00\x86\x06\x10\x47\x01\xc1\x37\x40\x00\x54\xb6\xb1\xa1\xa9\x99\x09\x48\x25\x1d\x40\x69\x71\x49\x62\x91\x02\xe5\x76\xa1\x79\x84\x21\x91\xd6\x80\x72\xaf\x8f\x82\x51\x30\x0a\x46\x36\x00\x00\xf0\x1c\x1e\x95\x00\x06\x00\x00") |
| 38 | |
| 39 | tmpDir := t.TempDir() |
| 40 | |
| 41 | r, err := compression.DecompressStream(bytes.NewReader(testFile)) |
| 42 | if err != nil { |
| 43 | t.Fatal(err) |
| 44 | } |
| 45 | defer r.Close() |
| 46 | _, err = Apply(context.Background(), tmpDir, r, WithNoSameOwner()) |
| 47 | if err != nil { |
| 48 | t.Fatal(err) |
| 49 | } |
| 50 | |
| 51 | baseName := "foo" |
| 52 | pth := strings.Repeat("a", 100-len(baseName)) + "/" + baseName |
| 53 | |
| 54 | _, err = os.Lstat(filepath.Join(tmpDir, pth)) |
| 55 | if err != nil { |
| 56 | t.Fatal(err) |
| 57 | } |
| 58 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…