testutil

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinPort = 2048
	MaxPort = 16384
)

Variables

This section is empty.

Functions

func CreateDB added in v0.8.0

func CreateDB(t *testing.T, log zerolog.Logger, ctx context.Context, dir string) (*sql.DB, lock.LockFactory, string)

func CreateDBWithType added in v0.8.0

func CreateDBWithType(t *testing.T, log zerolog.Logger, ctx context.Context, dir string, dbType sql.Type) (*sql.DB, lock.LockFactory, string)

func DBType added in v0.8.0

func DBType(t *testing.T) sql.Type

func GetFreePort

func GetFreePort(host string, tcp bool, udp bool) (string, error)

Hack to find a free tcp and udp port

func NewLogger added in v0.7.0

func NewLogger(t *testing.T) zerolog.Logger

func NewTestingWriter added in v0.7.0

func NewTestingWriter(t *testing.T) *testingWriter

func ParseEnv added in v0.2.0

func ParseEnv(envvar string) (string, string, error)

func ParseEnvs added in v0.2.0

func ParseEnvs(r io.Reader) (map[string]string, error)

func TestCreate added in v0.8.0

func TestCreate(t *testing.T, lastVersion uint, ddls DDLS, fixtures ImportFixtures, setupDBFn SetupDBFn)

func TestImportExport added in v0.8.0

func TestImportExport(t *testing.T, lastVersion uint, ddls DDLS, fixtures ImportFixtures, setupDBFn SetupDBFn, seqs map[string]uint64)

func TestMigrate added in v0.8.0

func TestMigrate(t *testing.T, lastVersion uint, ddls DDLS, fixtures ImportFixtures, setupDBFn SetupDBFn)

func Wait added in v0.2.0

func Wait(timeout time.Duration, f CheckFunc) error

Types

type CheckFunc added in v0.2.0

type CheckFunc func() (bool, error)

type DBContext added in v0.8.0

type DBContext struct {
	D            manager.DB
	DBM          *manager.DBManager
	LF           lock.LockFactory
	DBConnString string
}

func (*DBContext) AtlasConnString added in v0.8.0

func (c *DBContext) AtlasConnString() string

type DDL added in v0.8.0

type DDL struct {
	Postgres []string
	Sqlite3  []string
}

type DDLS added in v0.8.0

type DDLS map[uint]DDL

type GiteaConfig

type GiteaConfig struct {
	Data              string
	User              string
	HTTPListenAddress string
	HTTPPort          string
	SSHListenAddress  string
	SSHPort           string
}

type ImportFixtures added in v0.8.0

type ImportFixtures map[uint]string

type Process

type Process struct {
	Cmd *gexpect.ExpectSubprocess
	// contains filtered or unexported fields
}

func (*Process) Kill

func (p *Process) Kill()

func (*Process) Signal

func (p *Process) Signal(sig os.Signal) error

func (*Process) Start

func (p *Process) Start() error

func (*Process) StartExpect

func (p *Process) StartExpect() error

func (*Process) Stop

func (p *Process) Stop()

func (*Process) Wait

func (p *Process) Wait(timeout time.Duration) error

type SetupDBFn added in v0.8.0

type SetupDBFn func(ctx context.Context, t *testing.T, dir string) *DBContext

type TestGitea

type TestGitea struct {
	Process

	GiteaPath         string
	ConfigPath        string
	HTTPListenAddress string
	HTTPPort          string
	SSHListenAddress  string
	SSHPort           string
}

func NewTestGitea

func NewTestGitea(t *testing.T, dir, dockerBridgeAddress string, a ...string) (*TestGitea, error)

Jump to

Keyboard shortcuts

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