testing

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const EnvTestTags = "GO_TEST_TAGS"

Variables

This section is empty.

Functions

func EncodeED25519PrivateKey added in v0.2.0

func EncodeED25519PrivateKey(t *testing.T, privateKey ed25519.PrivateKey) string

EncodeED25519PrivateKey encodes an ED25519 private key to PEM format.

func EncodeED25519PublicKey added in v0.2.0

func EncodeED25519PublicKey(t *testing.T, publicKey ed25519.PublicKey) string

EncodeED25519PublicKey encodes an ED25519 public key to PEM format.

func EncodeRSAPrivateKey added in v0.2.0

func EncodeRSAPrivateKey(t *testing.T, privateKey *rsa.PrivateKey) string

EncodeRSAPrivateKey encodes an RSA private key to PEM format.

func EncodeRSAPublicKey added in v0.2.0

func EncodeRSAPublicKey(t *testing.T, publicKey *rsa.PublicKey) string

EncodeRSAPublicKey encodes an RSA public key to PEM format.

func FreePort added in v0.1.0

func FreePort(t *testing.T) string

FreePort returns a free port on localhost

func GenerateED25519KeyPair added in v0.2.0

func GenerateED25519KeyPair(t *testing.T) (public, private string)

GenerateED25519KeyPair generates a new ED25519 key pair and returns the paths to the public and private key files.

Example usage:

func TestExample(t *testing.T) {
	publicKeyPath, privateKeyPath := GenerateED25519KeyPair(t)
	// Use the key paths for testing crypto operations
	// Files are automatically cleaned up when test completes
}

func GenerateED25519PrivateKey added in v0.2.0

func GenerateED25519PrivateKey(t *testing.T) ed25519.PrivateKey

GenerateED25519PrivateKey generates a new ED25519 private key.

func GenerateED25519PublicKey added in v0.2.0

func GenerateED25519PublicKey(t *testing.T, privateKey ed25519.PrivateKey, filePath string)

GenerateED25519PublicKey generates a new public key from an ED25519 private key and writes it to a file.

func GenerateRSAKeyPair added in v0.2.0

func GenerateRSAKeyPair(t *testing.T) (public, private string)

GenerateRSAKeyPair generates a new RSA key pair and returns the paths to the public and private key files.

Example usage:

func TestExample(t *testing.T) {
	publicKeyPath, privateKeyPath := GenerateRSAKeyPair(t)
	// Use the key paths for testing crypto operations
	// Files are automatically cleaned up when test completes
}

func GenerateRSAPrivateKey added in v0.2.0

func GenerateRSAPrivateKey(t *testing.T) *rsa.PrivateKey

GenerateRSAPrivateKey generates a new RSA private key.

func GenerateRSAPublicKey added in v0.2.0

func GenerateRSAPublicKey(t *testing.T, privateKey *rsa.PrivateKey, filePath string)

GenerateRSAPublicKey generates a new public key from an RSA private key and writes it to a file.

func SkipTags added in v0.0.3

func SkipTags(tags ...tagx.Tag) bool

SkipTags returns true if the tag rules apply

func Tags

func Tags(t *testing.T, tags ...tagx.Tag)

Tags defines the tags that the test should run under.

For example:

func TestDemo(t *testing.T) {
  testing.Tags(t, tagx.Integration, tagx.Short)
}

Results being run with:

  • no tags
  • `GO_TEST_TAGS=fast`
  • `GO_TEST_TAGS=integration`
  • `GO_TEST_TAGS=fast,integration`

But would be skipped with:

  • `GO_TEST_TAGS=-fast`
  • `GO_TEST_TAGS=-integration`
  • `GO_TEST_TAGS=fast,-integration`

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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