testutil

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HelloArchiveURL points to an OCI archive of `hello-world`.
	// Exported from `docker.io/library/hello-world@sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec` .
	// See https://github.com/AkihiroSuda/test-oci-archives/releases/tag/v20210101
	HelloArchiveURL = "https://github.com/AkihiroSuda/test-oci-archives/releases/download/v20210101/hello-world.tar.gz"
	// HelloArchiveDigest is the digest of the archive.
	HelloArchiveDigest = "sha256:5aa022621c4de0e941ab2a30d4569c403e156b4ba2de2ec32e382ae8679f40e1"
)

Variables

This section is empty.

Functions

func BuildTar added in v0.4.0

func BuildTar(ents []TarEntry, opts ...Option) io.Reader

BuildTar builds a tar blob

func EnsureHello

func EnsureHello(ctx context.Context) (*ocispec.Descriptor, content.Store, error)

EnsureHello creates a temp content store and ensures `hello-world` image from HelloArchiveURL into the store.

Types

type DirectoryOption added in v0.4.0

type DirectoryOption func(o *dirOpts)

DirecoryOption is an option for a directory entry.

func WithDirMode added in v0.5.0

func WithDirMode(mode os.FileMode) DirectoryOption

WithFileMode specifies the mode of the directory.

func WithDirOwner added in v0.4.0

func WithDirOwner(uid, gid int) DirectoryOption

WithDirOwner specifies the owner of the directory.

func WithDirXattrs added in v0.5.0

func WithDirXattrs(xattrs map[string]string) DirectoryOption

WithDirXattrs specifies the extended attributes of the directory.

type FileOption added in v0.4.0

type FileOption func(o *fileOpts)

FileOption is an option for a file entry.

func WithFileMode added in v0.5.0

func WithFileMode(mode os.FileMode) FileOption

WithFileMode specifies the mode of the file.

func WithFileOwner added in v0.4.0

func WithFileOwner(uid, gid int) FileOption

WithFileOwner specifies the owner of the file.

func WithFileXattrs added in v0.4.0

func WithFileXattrs(xattrs map[string]string) FileOption

WithFileXattrs specifies the extended attributes of the file.

type Option added in v0.4.0

type Option func(o *Options)

Options is an option used during building blob.

func WithPrefix added in v0.4.0

func WithPrefix(prefix string) Option

WithPrefix is an option to add a prefix string to each file name (e.g. "./", "/", etc.)

type Options added in v0.4.0

type Options struct {

	// Prefix is the prefix string need to be added to each file name (e.g. "./", "/", etc.)
	Prefix string
}

Option is a set of options used during building blob.

type TarEntry added in v0.4.0

type TarEntry interface {
	AppendTar(tw *tar.Writer, opts Options) error
}

TarEntry is an entry of tar.

func Blockdev added in v0.4.0

func Blockdev(name string, major, minor int64) TarEntry

Blockdev is a block device entry

func Chardev added in v0.4.0

func Chardev(name string, major, minor int64) TarEntry

Chardev is a character device entry

func Dir added in v0.4.0

func Dir(name string, opts ...DirectoryOption) TarEntry

Dir is a directory entry

func Fifo added in v0.4.0

func Fifo(name string) TarEntry

Fifo is a fifo entry

func File added in v0.4.0

func File(name, contents string, opts ...FileOption) TarEntry

File is a regilar file entry

func Link(name, linkname string) TarEntry

Link is a hard-link entry

func Symlink(name, target string) TarEntry

Symlink is a symlink entry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL