testhelpers

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package testhelpers provides helpers for umoci's test suite. None of the code in this package is enabled when building a non-test umoci binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FtimeGranularity

func FtimeGranularity() time.Duration

FtimeGranularity is the filesystem timestamp granularity for this system. TODO: We should probably make this dependent on the path since some

filesystems can have different granularities...

func IsTestBinary

func IsTestBinary() bool

IsTestBinary returns whether the current binary is a test binary. This is only ever meant to be used so that test-specific initialisations can be done inside packages. Don't use it for anything else.

func MakeReadOnly

func MakeReadOnly(t *testing.T, path string)

MakeReadOnly makes the given path read-only (by bind-mounting it as "ro"). TODO: This should be done through an interface restriction in the test

(which is then backed up by the readonly mount if necessary). The fact
this test is necessary is a sign that we need a better split up of the
CAS interface.

func MakeReadWrite

func MakeReadWrite(t *testing.T, path string)

MakeReadWrite undos the effect of MakeReadOnly.

func RandomString

func RandomString(n int) string

RandomString returns a pseudorandom alphabetical (mixed-case) string.

func Unix

func Unix(sec, nsec int64) time.Time

Unix returns the local Time corresponding to the given Unix time, rounded to the timestamp granularity for this system.

Types

This section is empty.

Jump to

Keyboard shortcuts

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