build/: - archive_test.go: round-trip tests for tar.gz/zip, multi-file archives - signing_test.go: mock signer tests, path verification, error handling release/: - Fix nil pointer crash in linuxkit.go:50 (release.FS nil guard) - linuxkit_test.go: nil FS test case for the crash fix All 862 tests pass, go vet clean. Co-Authored-By: Virgil <virgil@lethean.io>
646 lines
17 KiB
Go
646 lines
17 KiB
Go
package build
|
|
|
|
import (
|
|
"archive/tar"
|
|
"archive/zip"
|
|
"bytes"
|
|
"compress/gzip"
|
|
"io"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/Snider/Borg/pkg/compress"
|
|
io_interface "forge.lthn.ai/core/go/pkg/io"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// setupArchiveTestFile creates a test binary file in a temp directory with the standard structure.
|
|
// Returns the path to the binary and the output directory.
|
|
func setupArchiveTestFile(t *testing.T, name, os_, arch string) (binaryPath string, outputDir string) {
|
|
t.Helper()
|
|
|
|
outputDir = t.TempDir()
|
|
|
|
// Create platform directory: dist/os_arch
|
|
platformDir := filepath.Join(outputDir, os_+"_"+arch)
|
|
err := os.MkdirAll(platformDir, 0755)
|
|
require.NoError(t, err)
|
|
|
|
// Create test binary
|
|
binaryPath = filepath.Join(platformDir, name)
|
|
content := []byte("#!/bin/bash\necho 'Hello, World!'\n")
|
|
err = os.WriteFile(binaryPath, content, 0755)
|
|
require.NoError(t, err)
|
|
|
|
return binaryPath, outputDir
|
|
}
|
|
|
|
func TestArchive_Good(t *testing.T) {
|
|
fs := io_interface.Local
|
|
t.Run("creates tar.gz for linux", func(t *testing.T) {
|
|
binaryPath, outputDir := setupArchiveTestFile(t, "myapp", "linux", "amd64")
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
result, err := Archive(fs, artifact)
|
|
require.NoError(t, err)
|
|
|
|
// Verify archive was created
|
|
expectedPath := filepath.Join(outputDir, "myapp_linux_amd64.tar.gz")
|
|
assert.Equal(t, expectedPath, result.Path)
|
|
assert.FileExists(t, result.Path)
|
|
|
|
// Verify OS and Arch are preserved
|
|
assert.Equal(t, "linux", result.OS)
|
|
assert.Equal(t, "amd64", result.Arch)
|
|
|
|
// Verify archive content
|
|
verifyTarGzContent(t, result.Path, "myapp")
|
|
})
|
|
|
|
t.Run("creates tar.gz for darwin", func(t *testing.T) {
|
|
binaryPath, outputDir := setupArchiveTestFile(t, "myapp", "darwin", "arm64")
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "darwin",
|
|
Arch: "arm64",
|
|
}
|
|
|
|
result, err := Archive(fs, artifact)
|
|
require.NoError(t, err)
|
|
|
|
expectedPath := filepath.Join(outputDir, "myapp_darwin_arm64.tar.gz")
|
|
assert.Equal(t, expectedPath, result.Path)
|
|
assert.FileExists(t, result.Path)
|
|
|
|
verifyTarGzContent(t, result.Path, "myapp")
|
|
})
|
|
|
|
t.Run("creates zip for windows", func(t *testing.T) {
|
|
binaryPath, outputDir := setupArchiveTestFile(t, "myapp.exe", "windows", "amd64")
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "windows",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
result, err := Archive(fs, artifact)
|
|
require.NoError(t, err)
|
|
|
|
// Windows archives should strip .exe from archive name
|
|
expectedPath := filepath.Join(outputDir, "myapp_windows_amd64.zip")
|
|
assert.Equal(t, expectedPath, result.Path)
|
|
assert.FileExists(t, result.Path)
|
|
|
|
verifyZipContent(t, result.Path, "myapp.exe")
|
|
})
|
|
|
|
t.Run("preserves checksum field", func(t *testing.T) {
|
|
binaryPath, _ := setupArchiveTestFile(t, "myapp", "linux", "amd64")
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
Checksum: "abc123",
|
|
}
|
|
|
|
result, err := Archive(fs, artifact)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, "abc123", result.Checksum)
|
|
})
|
|
|
|
t.Run("creates tar.xz for linux with ArchiveXZ", func(t *testing.T) {
|
|
binaryPath, outputDir := setupArchiveTestFile(t, "myapp", "linux", "amd64")
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
result, err := ArchiveXZ(fs, artifact)
|
|
require.NoError(t, err)
|
|
|
|
expectedPath := filepath.Join(outputDir, "myapp_linux_amd64.tar.xz")
|
|
assert.Equal(t, expectedPath, result.Path)
|
|
assert.FileExists(t, result.Path)
|
|
|
|
verifyTarXzContent(t, result.Path, "myapp")
|
|
})
|
|
|
|
t.Run("creates tar.xz for darwin with ArchiveWithFormat", func(t *testing.T) {
|
|
binaryPath, outputDir := setupArchiveTestFile(t, "myapp", "darwin", "arm64")
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "darwin",
|
|
Arch: "arm64",
|
|
}
|
|
|
|
result, err := ArchiveWithFormat(fs, artifact, ArchiveFormatXZ)
|
|
require.NoError(t, err)
|
|
|
|
expectedPath := filepath.Join(outputDir, "myapp_darwin_arm64.tar.xz")
|
|
assert.Equal(t, expectedPath, result.Path)
|
|
assert.FileExists(t, result.Path)
|
|
|
|
verifyTarXzContent(t, result.Path, "myapp")
|
|
})
|
|
|
|
t.Run("windows still uses zip even with xz format", func(t *testing.T) {
|
|
binaryPath, outputDir := setupArchiveTestFile(t, "myapp.exe", "windows", "amd64")
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "windows",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
result, err := ArchiveWithFormat(fs, artifact, ArchiveFormatXZ)
|
|
require.NoError(t, err)
|
|
|
|
// Windows should still get .zip regardless of format
|
|
expectedPath := filepath.Join(outputDir, "myapp_windows_amd64.zip")
|
|
assert.Equal(t, expectedPath, result.Path)
|
|
assert.FileExists(t, result.Path)
|
|
|
|
verifyZipContent(t, result.Path, "myapp.exe")
|
|
})
|
|
}
|
|
|
|
func TestArchive_Bad(t *testing.T) {
|
|
fs := io_interface.Local
|
|
t.Run("returns error for empty path", func(t *testing.T) {
|
|
artifact := Artifact{
|
|
Path: "",
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
result, err := Archive(fs, artifact)
|
|
assert.Error(t, err)
|
|
assert.Contains(t, err.Error(), "artifact path is empty")
|
|
assert.Empty(t, result.Path)
|
|
})
|
|
|
|
t.Run("returns error for non-existent file", func(t *testing.T) {
|
|
artifact := Artifact{
|
|
Path: "/nonexistent/path/binary",
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
result, err := Archive(fs, artifact)
|
|
assert.Error(t, err)
|
|
assert.Contains(t, err.Error(), "source file not found")
|
|
assert.Empty(t, result.Path)
|
|
})
|
|
|
|
t.Run("returns error for directory path", func(t *testing.T) {
|
|
dir := t.TempDir()
|
|
|
|
artifact := Artifact{
|
|
Path: dir,
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
result, err := Archive(fs, artifact)
|
|
assert.Error(t, err)
|
|
assert.Contains(t, err.Error(), "source path is a directory")
|
|
assert.Empty(t, result.Path)
|
|
})
|
|
}
|
|
|
|
func TestArchiveAll_Good(t *testing.T) {
|
|
fs := io_interface.Local
|
|
t.Run("archives multiple artifacts", func(t *testing.T) {
|
|
outputDir := t.TempDir()
|
|
|
|
// Create multiple binaries
|
|
var artifacts []Artifact
|
|
targets := []struct {
|
|
os_ string
|
|
arch string
|
|
}{
|
|
{"linux", "amd64"},
|
|
{"linux", "arm64"},
|
|
{"darwin", "arm64"},
|
|
{"windows", "amd64"},
|
|
}
|
|
|
|
for _, target := range targets {
|
|
platformDir := filepath.Join(outputDir, target.os_+"_"+target.arch)
|
|
err := os.MkdirAll(platformDir, 0755)
|
|
require.NoError(t, err)
|
|
|
|
name := "myapp"
|
|
if target.os_ == "windows" {
|
|
name = "myapp.exe"
|
|
}
|
|
|
|
binaryPath := filepath.Join(platformDir, name)
|
|
err = os.WriteFile(binaryPath, []byte("binary content"), 0755)
|
|
require.NoError(t, err)
|
|
|
|
artifacts = append(artifacts, Artifact{
|
|
Path: binaryPath,
|
|
OS: target.os_,
|
|
Arch: target.arch,
|
|
})
|
|
}
|
|
|
|
results, err := ArchiveAll(fs, artifacts)
|
|
require.NoError(t, err)
|
|
require.Len(t, results, 4)
|
|
|
|
// Verify all archives were created
|
|
for i, result := range results {
|
|
assert.FileExists(t, result.Path)
|
|
assert.Equal(t, artifacts[i].OS, result.OS)
|
|
assert.Equal(t, artifacts[i].Arch, result.Arch)
|
|
}
|
|
})
|
|
|
|
t.Run("returns nil for empty slice", func(t *testing.T) {
|
|
results, err := ArchiveAll(fs, []Artifact{})
|
|
assert.NoError(t, err)
|
|
assert.Nil(t, results)
|
|
})
|
|
|
|
t.Run("returns nil for nil slice", func(t *testing.T) {
|
|
results, err := ArchiveAll(fs, nil)
|
|
assert.NoError(t, err)
|
|
assert.Nil(t, results)
|
|
})
|
|
}
|
|
|
|
func TestArchiveAll_Bad(t *testing.T) {
|
|
fs := io_interface.Local
|
|
t.Run("returns partial results on error", func(t *testing.T) {
|
|
binaryPath, _ := setupArchiveTestFile(t, "myapp", "linux", "amd64")
|
|
|
|
artifacts := []Artifact{
|
|
{Path: binaryPath, OS: "linux", Arch: "amd64"},
|
|
{Path: "/nonexistent/binary", OS: "linux", Arch: "arm64"}, // This will fail
|
|
}
|
|
|
|
results, err := ArchiveAll(fs, artifacts)
|
|
assert.Error(t, err)
|
|
// Should have the first successful result
|
|
assert.Len(t, results, 1)
|
|
assert.FileExists(t, results[0].Path)
|
|
})
|
|
}
|
|
|
|
func TestArchiveFilename_Good(t *testing.T) {
|
|
t.Run("generates correct tar.gz filename", func(t *testing.T) {
|
|
artifact := Artifact{
|
|
Path: "/output/linux_amd64/myapp",
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
filename := archiveFilename(artifact, ".tar.gz")
|
|
assert.Equal(t, "/output/myapp_linux_amd64.tar.gz", filename)
|
|
})
|
|
|
|
t.Run("generates correct zip filename", func(t *testing.T) {
|
|
artifact := Artifact{
|
|
Path: "/output/windows_amd64/myapp.exe",
|
|
OS: "windows",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
filename := archiveFilename(artifact, ".zip")
|
|
assert.Equal(t, "/output/myapp_windows_amd64.zip", filename)
|
|
})
|
|
|
|
t.Run("handles nested output directories", func(t *testing.T) {
|
|
artifact := Artifact{
|
|
Path: "/project/dist/linux_arm64/cli",
|
|
OS: "linux",
|
|
Arch: "arm64",
|
|
}
|
|
|
|
filename := archiveFilename(artifact, ".tar.gz")
|
|
assert.Equal(t, "/project/dist/cli_linux_arm64.tar.gz", filename)
|
|
})
|
|
}
|
|
|
|
func TestArchive_RoundTrip_Good(t *testing.T) {
|
|
fs := io_interface.Local
|
|
|
|
t.Run("tar.gz round trip preserves content", func(t *testing.T) {
|
|
binaryPath, _ := setupArchiveTestFile(t, "roundtrip-app", "linux", "amd64")
|
|
|
|
// Read original content
|
|
originalContent, err := os.ReadFile(binaryPath)
|
|
require.NoError(t, err)
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
// Create archive
|
|
archiveArtifact, err := Archive(fs, artifact)
|
|
require.NoError(t, err)
|
|
assert.FileExists(t, archiveArtifact.Path)
|
|
|
|
// Extract and verify content matches
|
|
extractedContent := extractTarGzFile(t, archiveArtifact.Path, "roundtrip-app")
|
|
assert.Equal(t, originalContent, extractedContent)
|
|
})
|
|
|
|
t.Run("tar.xz round trip preserves content", func(t *testing.T) {
|
|
binaryPath, _ := setupArchiveTestFile(t, "roundtrip-xz", "linux", "arm64")
|
|
|
|
originalContent, err := os.ReadFile(binaryPath)
|
|
require.NoError(t, err)
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "linux",
|
|
Arch: "arm64",
|
|
}
|
|
|
|
archiveArtifact, err := ArchiveXZ(fs, artifact)
|
|
require.NoError(t, err)
|
|
assert.FileExists(t, archiveArtifact.Path)
|
|
|
|
extractedContent := extractTarXzFile(t, archiveArtifact.Path, "roundtrip-xz")
|
|
assert.Equal(t, originalContent, extractedContent)
|
|
})
|
|
|
|
t.Run("zip round trip preserves content", func(t *testing.T) {
|
|
binaryPath, _ := setupArchiveTestFile(t, "roundtrip.exe", "windows", "amd64")
|
|
|
|
originalContent, err := os.ReadFile(binaryPath)
|
|
require.NoError(t, err)
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "windows",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
archiveArtifact, err := Archive(fs, artifact)
|
|
require.NoError(t, err)
|
|
assert.FileExists(t, archiveArtifact.Path)
|
|
|
|
extractedContent := extractZipFile(t, archiveArtifact.Path, "roundtrip.exe")
|
|
assert.Equal(t, originalContent, extractedContent)
|
|
})
|
|
|
|
t.Run("tar.gz preserves file permissions", func(t *testing.T) {
|
|
binaryPath, _ := setupArchiveTestFile(t, "perms-app", "linux", "amd64")
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
archiveArtifact, err := Archive(fs, artifact)
|
|
require.NoError(t, err)
|
|
|
|
// Extract and verify permissions are preserved
|
|
mode := extractTarGzFileMode(t, archiveArtifact.Path, "perms-app")
|
|
// The original file was written with 0755
|
|
assert.Equal(t, os.FileMode(0755), mode&os.ModePerm)
|
|
})
|
|
|
|
t.Run("round trip with large binary content", func(t *testing.T) {
|
|
outputDir := t.TempDir()
|
|
platformDir := filepath.Join(outputDir, "linux_amd64")
|
|
require.NoError(t, os.MkdirAll(platformDir, 0755))
|
|
|
|
// Create a larger file (64KB)
|
|
largeContent := make([]byte, 64*1024)
|
|
for i := range largeContent {
|
|
largeContent[i] = byte(i % 256)
|
|
}
|
|
binaryPath := filepath.Join(platformDir, "large-app")
|
|
require.NoError(t, os.WriteFile(binaryPath, largeContent, 0755))
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
archiveArtifact, err := Archive(fs, artifact)
|
|
require.NoError(t, err)
|
|
|
|
extractedContent := extractTarGzFile(t, archiveArtifact.Path, "large-app")
|
|
assert.Equal(t, largeContent, extractedContent)
|
|
})
|
|
|
|
t.Run("archive is smaller than original for tar.gz", func(t *testing.T) {
|
|
outputDir := t.TempDir()
|
|
platformDir := filepath.Join(outputDir, "linux_amd64")
|
|
require.NoError(t, os.MkdirAll(platformDir, 0755))
|
|
|
|
// Create a compressible file (repeated pattern)
|
|
compressibleContent := make([]byte, 4096)
|
|
for i := range compressibleContent {
|
|
compressibleContent[i] = 'A'
|
|
}
|
|
binaryPath := filepath.Join(platformDir, "compressible-app")
|
|
require.NoError(t, os.WriteFile(binaryPath, compressibleContent, 0755))
|
|
|
|
artifact := Artifact{
|
|
Path: binaryPath,
|
|
OS: "linux",
|
|
Arch: "amd64",
|
|
}
|
|
|
|
archiveArtifact, err := Archive(fs, artifact)
|
|
require.NoError(t, err)
|
|
|
|
originalInfo, err := os.Stat(binaryPath)
|
|
require.NoError(t, err)
|
|
archiveInfo, err := os.Stat(archiveArtifact.Path)
|
|
require.NoError(t, err)
|
|
|
|
// Compressed archive should be smaller than original
|
|
assert.Less(t, archiveInfo.Size(), originalInfo.Size())
|
|
})
|
|
}
|
|
|
|
// extractTarGzFile extracts a named file from a tar.gz archive and returns its content.
|
|
func extractTarGzFile(t *testing.T, archivePath, fileName string) []byte {
|
|
t.Helper()
|
|
|
|
file, err := os.Open(archivePath)
|
|
require.NoError(t, err)
|
|
defer func() { _ = file.Close() }()
|
|
|
|
gzReader, err := gzip.NewReader(file)
|
|
require.NoError(t, err)
|
|
defer func() { _ = gzReader.Close() }()
|
|
|
|
tarReader := tar.NewReader(gzReader)
|
|
|
|
for {
|
|
header, err := tarReader.Next()
|
|
if err == io.EOF {
|
|
t.Fatalf("file %q not found in archive", fileName)
|
|
}
|
|
require.NoError(t, err)
|
|
|
|
if header.Name == fileName {
|
|
content, err := io.ReadAll(tarReader)
|
|
require.NoError(t, err)
|
|
return content
|
|
}
|
|
}
|
|
}
|
|
|
|
// extractTarGzFileMode extracts the file mode of a named file from a tar.gz archive.
|
|
func extractTarGzFileMode(t *testing.T, archivePath, fileName string) os.FileMode {
|
|
t.Helper()
|
|
|
|
file, err := os.Open(archivePath)
|
|
require.NoError(t, err)
|
|
defer func() { _ = file.Close() }()
|
|
|
|
gzReader, err := gzip.NewReader(file)
|
|
require.NoError(t, err)
|
|
defer func() { _ = gzReader.Close() }()
|
|
|
|
tarReader := tar.NewReader(gzReader)
|
|
|
|
for {
|
|
header, err := tarReader.Next()
|
|
if err == io.EOF {
|
|
t.Fatalf("file %q not found in archive", fileName)
|
|
}
|
|
require.NoError(t, err)
|
|
|
|
if header.Name == fileName {
|
|
return header.FileInfo().Mode()
|
|
}
|
|
}
|
|
}
|
|
|
|
// extractTarXzFile extracts a named file from a tar.xz archive and returns its content.
|
|
func extractTarXzFile(t *testing.T, archivePath, fileName string) []byte {
|
|
t.Helper()
|
|
|
|
xzData, err := os.ReadFile(archivePath)
|
|
require.NoError(t, err)
|
|
|
|
tarData, err := compress.Decompress(xzData)
|
|
require.NoError(t, err)
|
|
|
|
tarReader := tar.NewReader(bytes.NewReader(tarData))
|
|
|
|
for {
|
|
header, err := tarReader.Next()
|
|
if err == io.EOF {
|
|
t.Fatalf("file %q not found in archive", fileName)
|
|
}
|
|
require.NoError(t, err)
|
|
|
|
if header.Name == fileName {
|
|
content, err := io.ReadAll(tarReader)
|
|
require.NoError(t, err)
|
|
return content
|
|
}
|
|
}
|
|
}
|
|
|
|
// extractZipFile extracts a named file from a zip archive and returns its content.
|
|
func extractZipFile(t *testing.T, archivePath, fileName string) []byte {
|
|
t.Helper()
|
|
|
|
reader, err := zip.OpenReader(archivePath)
|
|
require.NoError(t, err)
|
|
defer func() { _ = reader.Close() }()
|
|
|
|
for _, f := range reader.File {
|
|
if f.Name == fileName {
|
|
rc, err := f.Open()
|
|
require.NoError(t, err)
|
|
defer func() { _ = rc.Close() }()
|
|
|
|
content, err := io.ReadAll(rc)
|
|
require.NoError(t, err)
|
|
return content
|
|
}
|
|
}
|
|
|
|
t.Fatalf("file %q not found in zip archive", fileName)
|
|
return nil
|
|
}
|
|
|
|
// verifyTarGzContent opens a tar.gz file and verifies it contains the expected file.
|
|
func verifyTarGzContent(t *testing.T, archivePath, expectedName string) {
|
|
t.Helper()
|
|
|
|
file, err := os.Open(archivePath)
|
|
require.NoError(t, err)
|
|
defer func() { _ = file.Close() }()
|
|
|
|
gzReader, err := gzip.NewReader(file)
|
|
require.NoError(t, err)
|
|
defer func() { _ = gzReader.Close() }()
|
|
|
|
tarReader := tar.NewReader(gzReader)
|
|
|
|
header, err := tarReader.Next()
|
|
require.NoError(t, err)
|
|
assert.Equal(t, expectedName, header.Name)
|
|
|
|
// Verify there's only one file
|
|
_, err = tarReader.Next()
|
|
assert.Equal(t, io.EOF, err)
|
|
}
|
|
|
|
// verifyZipContent opens a zip file and verifies it contains the expected file.
|
|
func verifyZipContent(t *testing.T, archivePath, expectedName string) {
|
|
t.Helper()
|
|
|
|
reader, err := zip.OpenReader(archivePath)
|
|
require.NoError(t, err)
|
|
defer func() { _ = reader.Close() }()
|
|
|
|
require.Len(t, reader.File, 1)
|
|
assert.Equal(t, expectedName, reader.File[0].Name)
|
|
}
|
|
|
|
// verifyTarXzContent opens a tar.xz file and verifies it contains the expected file.
|
|
func verifyTarXzContent(t *testing.T, archivePath, expectedName string) {
|
|
t.Helper()
|
|
|
|
// Read the xz-compressed file
|
|
xzData, err := os.ReadFile(archivePath)
|
|
require.NoError(t, err)
|
|
|
|
// Decompress with Borg
|
|
tarData, err := compress.Decompress(xzData)
|
|
require.NoError(t, err)
|
|
|
|
// Read tar archive
|
|
tarReader := tar.NewReader(bytes.NewReader(tarData))
|
|
|
|
header, err := tarReader.Next()
|
|
require.NoError(t, err)
|
|
assert.Equal(t, expectedName, header.Name)
|
|
|
|
// Verify there's only one file
|
|
_, err = tarReader.Next()
|
|
assert.Equal(t, io.EOF, err)
|
|
}
|