Documentation
¶
Index ¶
- Constants
- func EncodeED25519PrivateKey(t *testing.T, privateKey ed25519.PrivateKey) string
- func EncodeED25519PublicKey(t *testing.T, publicKey ed25519.PublicKey) string
- func EncodeRSAPrivateKey(t *testing.T, privateKey *rsa.PrivateKey) string
- func EncodeRSAPublicKey(t *testing.T, publicKey *rsa.PublicKey) string
- func FreePort(t *testing.T) string
- func GenerateED25519KeyPair(t *testing.T) (public, private string)
- func GenerateED25519PrivateKey(t *testing.T) ed25519.PrivateKey
- func GenerateED25519PublicKey(t *testing.T, privateKey ed25519.PrivateKey, filePath string)
- func GenerateRSAKeyPair(t *testing.T) (public, private string)
- func GenerateRSAPrivateKey(t *testing.T) *rsa.PrivateKey
- func GenerateRSAPublicKey(t *testing.T, privateKey *rsa.PrivateKey, filePath string)
- func SkipTags(tags ...tagx.Tag) bool
- func Tags(t *testing.T, tags ...tagx.Tag)
Constants ¶
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
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
EncodeRSAPublicKey encodes an RSA public key to PEM format.
func GenerateED25519KeyPair ¶ added in v0.2.0
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
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 Tags ¶
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.