testutils

package
v1.26.0-120.6 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CAFilePath

func CAFilePath(dir string) string

func CertFilePath

func CertFilePath(dir string) string

func ConvertFileToBase64

func ConvertFileToBase64(file string) string

func CreateTemp

func CreateTemp(t testing.TB, dir, pattern string) *os.File

CreateTemp is a helper function which creates a temporary file, and it is automatically closed after test is completed

func GenerateSelfSignedCA

func GenerateSelfSignedCA(filePath string) (*tls.Certificate, error)

func GenerateSelfSignedCAPool

func GenerateSelfSignedCAPool(caCert *tls.Certificate) (*x509.CertPool, error)

func GenerateServerCert

func GenerateServerCert(
	caCert *tls.Certificate,
	commonName string,
	serialNumber int64,
	certPubFile string,
	certPrivFile string,
) (*tls.Certificate, error)

func GenerateTestCerts

func GenerateTestCerts(tempDir string, commonName string, num int) ([]*tls.Certificate, *x509.CertPool, *x509.CertPool, error)

func GetRepoRootDirectory

func GetRepoRootDirectory(opts ...Option) string

GetRepoRootDirectory returns the root directory of the temporal repo.

func KeyFilePath

func KeyFilePath(dir string) string

func MkdirTemp

func MkdirTemp(t testing.TB, dir, pattern string) string

MkdirTemp is a helper function which creates a temporary directory, and they are automatically removed after test is completed

Types

type CertChain

type CertChain struct {
	CertPubFile string
	CertKeyFile string
	CaPubFile   string
}

func GenerateTestChain

func GenerateTestChain(tempDir string, commonName string) (CertChain, error)

func GenerateTestChainWithSN

func GenerateTestChainWithSN(tempDir string, commonName string, serialNumber int64,
) (CertChain, *tls.Certificate, error)

type Option

type Option func(os *osParams)

func WithGetenv

func WithGetenv(getenv func(string) string) Option

Jump to

Keyboard shortcuts

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