Documentation
¶
Index ¶
- Constants
- Variables
- func AssertDeepStackErrorFromRequest(t *testing.T, err error, expectedResponseBodyErrorMessage string)
- func AssertInvalidInputError(t *testing.T, err error)
- func BuildArtifacts(tr *taskrunner.TaskRunner, moduleRoot string)
- func BuildWholeGoProject(Tr *taskrunner.TaskRunner, directory string)
- func Close(r Closable)
- func CollectBuildTags(dir string) ([]string, error)
- func DecodeAuthorizedEd25519PublicKey(authorizedKey []byte) (ed25519.PublicKey, error)
- func DecodeEd25519PrivateKeyOpenSSH(privateKeyOpenSSH []byte) (ed25519.PrivateKey, error)
- func ExtractError(err error) string
- func FindDir(dirName string) (string, error)
- func FormatRelativeDuration(now, target time.Time) string
- func GetLocalTestingPrivateKeyBytes() []byte
- func GetLocalTestingPrivateKeyOpenSSH() string
- func GetLocalTestingPublicKeyFingerprintSHA256() string
- func GetLocalTestingPublicKeyRaw() []byte
- func IsGeneratedArtifactFile(fileName string) bool
- func IsSystemApp(appName string) bool
- func MapOf(elements ...string) map[string]any
- func NewDockerRuntimeCleanupCommand(tr *taskrunner.TaskRunner) *cobra.Command
- func NewFileHandler(level slog.Level) *slog.JSONHandler
- func ReadLicenseKeyFromUserConfig() (string, error)
- func RecoverHttpPanics(next http.Handler) http.Handler
- func RemoveDir(path string)
- func RemoveGeneratedArtifacts(rootDir string)
- func RenderDefaultPage(htmlContent string) string
- func RunAndLogIfError(fn func() error)
- func SendJsonResponse(w http.ResponseWriter, data any)
- func SetCookieHeaders(req *http.Request, c *ComponentClient)
- func ShowHelpCommand(cmd *cobra.Command)
- func UnpackResponse[T any](object any) (*T, error)
- func WriteResponseError(w http.ResponseWriter, expectedErrors map[string]any, err error, ...)
- func WriteResponseErrorAlways(w http.ResponseWriter, err error, context ...any)
- type ArtifactDiscovery
- type AuthHelper
- type AuthHelperImpl
- func (a *AuthHelperImpl) DoesMatchSaltedHash(clearText, saltedHash string) bool
- func (a *AuthHelperImpl) GenerateCookie() (*http.Cookie, error)
- func (a *AuthHelperImpl) GenerateSecret() (string, error)
- func (a *AuthHelperImpl) GetSHA256Hash(plainText string) string
- func (a *AuthHelperImpl) GetTimeInSevenDays() time.Time
- func (a *AuthHelperImpl) SaltAndHash(clearText string) (string, error)
- type BytesSigner
- type BytesSignerImpl
- type Closable
- type ComponentClient
- type ComposeSyntaxChecker
- type DatabaseConnector
- type DatabaseSnapshotRepository
- type DatabaseSnapshotRepositoryImpl
- type DatabaseUtils
- type DatabaseUtilsImpl
- type DockerCliWrapper
- type DockerCliWrapperImpl
- type EmailClient
- type EmailClientImpl
- type EmailClientMock
- type EmailConfig
- type FileSystemOperator
- type FileSystemOperatorImpl
- type GoTestCommand
- type OsWrapper
- type OsWrapperImpl
- func (o *OsWrapperImpl) AllocateLocalhostPort() (string, error)
- func (o *OsWrapperImpl) DoesFileExist(path string) (bool, error)
- func (o *OsWrapperImpl) GetTempDir() (string, error)
- func (o *OsWrapperImpl) MkdirAll(path string, perm os.FileMode) error
- func (o *OsWrapperImpl) Now() time.Time
- func (o *OsWrapperImpl) PromptUser(prompt string) (string, error)
- func (o *OsWrapperImpl) ReadDir(path string) ([]os.DirEntry, error)
- func (o *OsWrapperImpl) ReadFile(path string) ([]byte, error)
- func (o *OsWrapperImpl) Remove(path string) error
- func (o *OsWrapperImpl) RemoveAll(path string) error
- func (o *OsWrapperImpl) Sleep(duration time.Duration)
- func (o *OsWrapperImpl) WriteFile(path string, data []byte, perm os.FileMode) error
- type SimpleFile
Constants ¶
View Source
const ( DefaultPostgresPort = "5432" PostgresAdminDatabase = "postgres" PostgresApplicationDatabase = "application" PostgresApplicationTemplate = "application_template" )
View Source
const ( DirectoryField = "directory" SizeInBytesField = "size_in_bytes" FolderToFindField = "folder_to_find" InitialDirField = "initial_directory" HostField = "host" CurrentAttemptField = "current_attempt" MaximumAttemptsFields = "maximum_attempts" PortField = "port" )
View Source
const ( BrandName = "quollix" OfficialMaintainer = BrandName OfficialBrandAppName = BrandName OfficialDatabaseAppName = "postgres" )
View Source
const EmailServiceNotEnabledErrorMessage = "email service is not enabled"
View Source
const LicenseTokenSigningPublicKeyOpenSSH = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEC2+vXmZ/qX7vwL7Y2CWt65j3765Xe/n84E//XvS5h/" // #nosec G101: public key used by tests, not a credential
View Source
const LocalTestingPublicKeyOpenSSH = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF70YNMkl2Wedmpo2UszvIrXJqr/pgCpevysNjjwtUig"
Variables ¶
View Source
var ( Logger = deepstack.NewDeepStackLogger(deepstack.NewRawConsoleHandler(slog.LevelInfo)) OperationFailedError = "Operation failed" )
View Source
var LicenseTokenSigningPublicKeyOpenSSHBytes = []byte(LicenseTokenSigningPublicKeyOpenSSH)
View Source
var LocalTestingPublicKeyOpenSSHBytes = []byte(LocalTestingPublicKeyOpenSSH)
Functions ¶
func AssertInvalidInputError ¶
func BuildArtifacts ¶
func BuildArtifacts(tr *taskrunner.TaskRunner, moduleRoot string)
func BuildWholeGoProject ¶
func BuildWholeGoProject(Tr *taskrunner.TaskRunner, directory string)
BuildWholeGoProject this function is meant to detect compile errors in the test code with build tags
func CollectBuildTags ¶
func DecodeEd25519PrivateKeyOpenSSH ¶
func DecodeEd25519PrivateKeyOpenSSH(privateKeyOpenSSH []byte) (ed25519.PrivateKey, error)
func ExtractError ¶
func FormatRelativeDuration ¶
func GetLocalTestingPrivateKeyBytes ¶
func GetLocalTestingPrivateKeyBytes() []byte
func GetLocalTestingPrivateKeyOpenSSH ¶
func GetLocalTestingPrivateKeyOpenSSH() string
func GetLocalTestingPublicKeyFingerprintSHA256 ¶
func GetLocalTestingPublicKeyFingerprintSHA256() string
func GetLocalTestingPublicKeyRaw ¶
func GetLocalTestingPublicKeyRaw() []byte
func IsGeneratedArtifactFile ¶
func IsSystemApp ¶
func NewDockerRuntimeCleanupCommand ¶
func NewDockerRuntimeCleanupCommand(tr *taskrunner.TaskRunner) *cobra.Command
func NewFileHandler ¶
func NewFileHandler(level slog.Level) *slog.JSONHandler
func RemoveGeneratedArtifacts ¶
func RemoveGeneratedArtifacts(rootDir string)
func RenderDefaultPage ¶
func RunAndLogIfError ¶
func RunAndLogIfError(fn func() error)
func SendJsonResponse ¶
func SendJsonResponse(w http.ResponseWriter, data any)
func SetCookieHeaders ¶
func SetCookieHeaders(req *http.Request, c *ComponentClient)
func ShowHelpCommand ¶
func UnpackResponse ¶
func WriteResponseError ¶
func WriteResponseError(w http.ResponseWriter, expectedErrors map[string]any, err error, context ...any)
WriteResponseError Here we can define a set of expected error messages that can safely be exposed to clients. If the error matches one of these strings, it is returned unchanged. Otherwise, a default message is used to ensure that no sensitive error messages are returned.
func WriteResponseErrorAlways ¶
func WriteResponseErrorAlways(w http.ResponseWriter, err error, context ...any)
Types ¶
type ArtifactDiscovery ¶
func DiscoverArtifacts ¶
func DiscoverArtifacts(moduleRoot string) (ArtifactDiscovery, error)
type AuthHelper ¶
type AuthHelperImpl ¶
type AuthHelperImpl struct{}
func (*AuthHelperImpl) DoesMatchSaltedHash ¶
func (a *AuthHelperImpl) DoesMatchSaltedHash(clearText, saltedHash string) bool
func (*AuthHelperImpl) GenerateCookie ¶
func (a *AuthHelperImpl) GenerateCookie() (*http.Cookie, error)
func (*AuthHelperImpl) GenerateSecret ¶
func (a *AuthHelperImpl) GenerateSecret() (string, error)
func (*AuthHelperImpl) GetSHA256Hash ¶
func (a *AuthHelperImpl) GetSHA256Hash(plainText string) string
func (*AuthHelperImpl) GetTimeInSevenDays ¶
func (a *AuthHelperImpl) GetTimeInSevenDays() time.Time
func (*AuthHelperImpl) SaltAndHash ¶
func (a *AuthHelperImpl) SaltAndHash(clearText string) (string, error)
type BytesSigner ¶
type BytesSignerImpl ¶
type BytesSignerImpl struct{}
func (*BytesSignerImpl) SignBytes ¶
func (c *BytesSignerImpl) SignBytes(privateKey ed25519.PrivateKey, payloadBytes []byte) []byte
func (*BytesSignerImpl) VerifyBytes ¶
type ComponentClient ¶
type ComponentClient struct {
Cookie *http.Cookie
SetCookieHeader bool
RootUrl string
Origin string
VerifyCertificate bool
}
func (*ComponentClient) DoRequest ¶
func (c *ComponentClient) DoRequest(path string, payload any) ([]byte, error)
func (*ComponentClient) DoRequestWithFullResponse ¶
type ComposeSyntaxChecker ¶
type DatabaseConnector ¶
type DatabaseSnapshotRepositoryImpl ¶
type DatabaseSnapshotRepositoryImpl struct {
DatabaseHost string
DatabasePort string
ApplicationDatabaseName string
TemplateDatabaseName string
AdminDatabaseName string
DatabaseConnector DatabaseConnector
DatabaseUtils DatabaseUtils
}
func NewDatabaseSnapshotRepository ¶
func NewDatabaseSnapshotRepository( databaseHost string, databaseConnector DatabaseConnector, databaseUtils DatabaseUtils, ) *DatabaseSnapshotRepositoryImpl
func (*DatabaseSnapshotRepositoryImpl) CreateDatabaseSnapshot ¶
func (d *DatabaseSnapshotRepositoryImpl) CreateDatabaseSnapshot() error
func (*DatabaseSnapshotRepositoryImpl) DeleteDatabaseSnapshotIfExists ¶
func (d *DatabaseSnapshotRepositoryImpl) DeleteDatabaseSnapshotIfExists() error
func (*DatabaseSnapshotRepositoryImpl) ResetDatabaseToSnapshot ¶
func (d *DatabaseSnapshotRepositoryImpl) ResetDatabaseToSnapshot() error
func (*DatabaseSnapshotRepositoryImpl) SnapshotExists ¶
func (d *DatabaseSnapshotRepositoryImpl) SnapshotExists() (bool, error)
type DatabaseUtils ¶
type DatabaseUtilsImpl ¶
type DatabaseUtilsImpl struct{}
func (*DatabaseUtilsImpl) EnsureDatabaseExists ¶
func (d *DatabaseUtilsImpl) EnsureDatabaseExists(host, port, databaseName string) error
func (*DatabaseUtilsImpl) RunMigrations ¶
func (d *DatabaseUtilsImpl) RunMigrations(migrationsDir, host, port, databaseName string) error
func (*DatabaseUtilsImpl) WaitForPostgresDb ¶
func (d *DatabaseUtilsImpl) WaitForPostgresDb(host, port, databaseName string) (*sql.DB, error)
type DockerCliWrapper ¶
type DockerCliWrapperImpl ¶
type DockerCliWrapperImpl struct{}
func (*DockerCliWrapperImpl) DeleteImage ¶
func (d *DockerCliWrapperImpl) DeleteImage(image string) error
func (*DockerCliWrapperImpl) ImageExists ¶
func (d *DockerCliWrapperImpl) ImageExists(image string) (bool, error)
func (*DockerCliWrapperImpl) IsContainerRunning ¶
func (d *DockerCliWrapperImpl) IsContainerRunning(containerName string) (bool, error)
type EmailClient ¶
type EmailClient interface {
SendEmail(emailConfig *EmailConfig, to, subject, body string) error
CheckEmailServerConnection(emailConfig *EmailConfig) error
}
type EmailClientImpl ¶
type EmailClientImpl struct{}
func (*EmailClientImpl) CheckEmailServerConnection ¶
func (e *EmailClientImpl) CheckEmailServerConnection(emailConfig *EmailConfig) error
func (*EmailClientImpl) SendEmail ¶
func (e *EmailClientImpl) SendEmail(emailConfig *EmailConfig, to, subject, body string) error
type EmailClientMock ¶
type EmailClientMock struct{}
func (EmailClientMock) CheckEmailServerConnection ¶
func (e EmailClientMock) CheckEmailServerConnection(emailConfig *EmailConfig) error
func (EmailClientMock) SendEmail ¶
func (e EmailClientMock) SendEmail(emailConfig *EmailConfig, to, subject, body string) error
type EmailConfig ¶
type EmailConfig struct {
SMTPHost string `validate:"host" json:"smtp_host"`
SMTPPort string `validate:"number" json:"smtp_port"`
FromEmailAddress string `validate:"email" json:"from_email_address"`
EmailAccountUsername string `validate:"loose" json:"email_account_username"`
EmailAccountPassword string `validate:"loose" json:"email_account_password"`
IsEnabled bool `json:"is_enabled"`
}
type FileSystemOperator ¶
type FileSystemOperator interface {
ListFiles(dir string) ([]SimpleFile, error)
ReadYamlFile(dir string) (map[string]any, error)
CheckDockerComposeSyntax(composeFileBytes []byte) error
}
func NewFileSystemOperator ¶
func NewFileSystemOperator(osWrapper OsWrapper) FileSystemOperator
type FileSystemOperatorImpl ¶
type FileSystemOperatorImpl struct {
OsWrapper OsWrapper
}
func (*FileSystemOperatorImpl) CheckDockerComposeSyntax ¶
func (f *FileSystemOperatorImpl) CheckDockerComposeSyntax(composeFileBytes []byte) error
func (*FileSystemOperatorImpl) ListFiles ¶
func (f *FileSystemOperatorImpl) ListFiles(dir string) ([]SimpleFile, error)
func (*FileSystemOperatorImpl) ReadYamlFile ¶
func (f *FileSystemOperatorImpl) ReadYamlFile(path string) (map[string]any, error)
type GoTestCommand ¶
type GoTestCommand struct {
// contains filtered or unexported fields
}
func GoTest ¶
func GoTest(directory string) *GoTestCommand
func (*GoTestCommand) Env ¶
func (c *GoTestCommand) Env(key, value string) *GoTestCommand
func (*GoTestCommand) Filter ¶
func (c *GoTestCommand) Filter(runFilter string) *GoTestCommand
func (*GoTestCommand) Run ¶
func (c *GoTestCommand) Run(tr *taskrunner.TaskRunner)
func (*GoTestCommand) Tag ¶
func (c *GoTestCommand) Tag(buildTag string) *GoTestCommand
type OsWrapper ¶
type OsWrapper interface {
ReadFile(path string) ([]byte, error)
WriteFile(path string, data []byte, perm os.FileMode) error
Remove(path string) error
RemoveAll(path string) error
MkdirAll(path string, perm os.FileMode) error
ReadDir(path string) ([]os.DirEntry, error)
GetTempDir() (string, error)
DoesFileExist(path string) (bool, error)
AllocateLocalhostPort() (string, error)
Now() time.Time
PromptUser(prompt string) (string, error)
Sleep(duration time.Duration)
}
type OsWrapperImpl ¶
type OsWrapperImpl struct{}
func (*OsWrapperImpl) AllocateLocalhostPort ¶
func (o *OsWrapperImpl) AllocateLocalhostPort() (string, error)
func (*OsWrapperImpl) DoesFileExist ¶
func (o *OsWrapperImpl) DoesFileExist(path string) (bool, error)
func (*OsWrapperImpl) GetTempDir ¶
func (o *OsWrapperImpl) GetTempDir() (string, error)
func (*OsWrapperImpl) MkdirAll ¶
func (o *OsWrapperImpl) MkdirAll(path string, perm os.FileMode) error
func (*OsWrapperImpl) Now ¶
func (o *OsWrapperImpl) Now() time.Time
func (*OsWrapperImpl) PromptUser ¶
func (o *OsWrapperImpl) PromptUser(prompt string) (string, error)
func (*OsWrapperImpl) Remove ¶
func (o *OsWrapperImpl) Remove(path string) error
func (*OsWrapperImpl) RemoveAll ¶
func (o *OsWrapperImpl) RemoveAll(path string) error
func (*OsWrapperImpl) Sleep ¶
func (o *OsWrapperImpl) Sleep(duration time.Duration)
type SimpleFile ¶
Source Files
¶
- artifacts.go
- auth.go
- bytes_signer.go
- cobra.go
- database.go
- database_snapshot.go
- default_frontend_page.go
- docker_cleanup_command.go
- docker_cli_wrapper.go
- email_client.go
- file_system_operator.go
- filesystem.go
- go_test_command.go
- http.go
- http_recover.go
- license_key_config.go
- logger.go
- os_wrapper.go
- relative_time.go
- ssh_keys.go
- testing_keys.go
- utils.go
Click to show internal directories.
Click to hide internal directories.