package tartest

import "git.jakstys.lt/motiejus/undocker/rootfs/internal/tartest"

Index

Types

type Dir

type Dir struct {
	Name string
	UID  int
}

Dir is a tarrable directory representation

func (Dir) Tar

func (d Dir) Tar(tw *tar.Writer) error

Tar tars the Dir

type Extractable

type Extractable interface{}

Extractable is an empty interface for comparing extracted outputs in tests. Using that just to avoid the ugly `interface{}`.

func Extract

func Extract(t *testing.T, r io.Reader) []Extractable

Extract extracts a tarball to a slice of extractables

type File

type File struct {
	Name     string
	UID      int
	Contents *bytes.Buffer
}

File is a tarrable file representation

func (File) Tar

func (f File) Tar(tw *tar.Writer) error

Tar tars the File

type Hardlink struct {
	Name string
	UID  int
}

Hardlink is a representation of a hardlink

func (Hardlink) Tar

func (h Hardlink) Tar(tw *tar.Writer) error

Tar tars the Hardlink

type Tarball

type Tarball []Tarrer

Tarball is a list of tarrables

func (Tarball) Buffer

func (tb Tarball) Buffer() *bytes.Buffer

Buffer returns a byte buffer

func (Tarball) Gzip

func (tb Tarball) Gzip() *bytes.Buffer

Gzip returns a gzipped buffer

type Tarrer

type Tarrer interface {
	Tar(*tar.Writer) error
}

Tarrer is an object that can tar itself to an archive

Source Files

tartest.go

Version
v1.2.3 (latest)
Published
Sep 10, 2024
Platform
linux/amd64
Imports
6 packages
Last checked
3 weeks ago

Tools for package owners.