testutil

package
v0.3.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testutil contains test utilities for krew.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type P

type P struct {
	// contains filtered or unexported fields
}

func NewPlugin

func NewPlugin() *P

NewPlugin builds a index.Plugin that is valid.

func (*P) V

func (p *P) V() index.Plugin

func (*P) WithName

func (p *P) WithName(s string) *P

func (*P) WithPlatforms

func (p *P) WithPlatforms(v ...index.Platform) *P

func (*P) WithShortDescription

func (p *P) WithShortDescription(v string) *P

func (*P) WithTypeMeta

func (p *P) WithTypeMeta(v metav1.TypeMeta) *P

func (*P) WithVersion

func (p *P) WithVersion(v string) *P

type R

type R struct {
	// contains filtered or unexported fields
}

func NewPlatform

func NewPlatform() *R

func (*R) V

func (p *R) V() index.Platform

func (*R) WithBin

func (p *R) WithBin(v string) *R

func (*R) WithFiles

func (p *R) WithFiles(v []index.FileOperation) *R

func (*R) WithOS

func (p *R) WithOS(os string) *R

func (*R) WithOSArch

func (p *R) WithOSArch(os, arch string) *R

func (*R) WithOSes

func (p *R) WithOSes(os ...string) *R

func (*R) WithSHA256

func (p *R) WithSHA256(v string) *R

func (*R) WithSelector

func (p *R) WithSelector(v *metav1.LabelSelector) *R

func (*R) WithURI

func (p *R) WithURI(v string) *R

type TempDir

type TempDir struct {
	// contains filtered or unexported fields
}

func NewTempDir

func NewTempDir(t *testing.T) (tmpDir *TempDir, cleanup func())

NewTempDir creates a temporary directory and a cleanup function. It is the responsibility of calling code to call cleanup when done.

func (*TempDir) Path

func (td *TempDir) Path(file string) string

Path returns the path to a file in the temp directory. The input file is expected to use '/' as directory separator regardless of the host OS.

func (*TempDir) Root

func (td *TempDir) Root() string

Root returns the root of the temporary directory.

func (*TempDir) Write

func (td *TempDir) Write(file string, content []byte) *TempDir

Write creates a file containing content in the temporary directory.

Jump to

Keyboard shortcuts

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