Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
package v1
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestValidateServiceAccountEmail(t *testing.T) {
t.Parallel()
tests := []struct {
name string
email string
valid bool
}{
{
name: "valid",
email: "[email protected]",
valid: true,
},
{
name: "invalid syntax",
email: "[email protected]",
valid: false,
},
{
name: "wrong suffix",
email: "[email protected]",
valid: false,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
err := validateServiceAccountEmail(test.email)
if test.valid {
require.NoError(t, err)
return
}
require.Error(t, err)
})
}
}
func TestValidateWorkloadIdentityEmail(t *testing.T) {
t.Parallel()
tests := []struct {
name string
email string
valid bool
}{
{
name: "valid",
email: "[email protected]",
valid: true,
},
{
name: "invalid syntax",
email: "[email protected]",
valid: false,
},
{
name: "wrong suffix",
email: "[email protected]",
valid: false,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
err := validateWorkloadIdentityEmail(test.email)
if test.valid {
require.NoError(t, err)
return
}
require.Error(t, err)
})
}
}