Documentation
¶
Index ¶
- type Result
- func (r *Result) AssertApplied(n int) *Result
- func (r *Result) AssertError(substring string) *Result
- func (r *Result) AssertErrors(n int) *Result
- func (r *Result) AssertExitCode(code int) *Result
- func (r *Result) AssertFileExists(fileKey string) *Result
- func (r *Result) AssertFileNotExists(fileKey string) *Result
- func (r *Result) AssertHasKey(fileKey, path string) *Result
- func (r *Result) AssertKey(fileKey, path string, expected any) *Result
- func (r *Result) AssertMissingKey(fileKey, path string) *Result
- func (r *Result) AssertOutputExists() *Result
- func (r *Result) AssertPathExists(rel string) *Result
- func (r *Result) AssertPending(n int) *Result
- func (r *Result) AssertSuccess() *Result
- func (r *Result) AssertUntouched(fileKey string) *Result
- func (r *Result) AssertVersion(fileKey, version string) *Result
- func (r *Result) AssertWarnings(n int) *Result
- type Scenario
- func (s *Scenario) Env(key, value string) *Scenario
- func (s *Scenario) Init() *Result
- func (s *Scenario) Input(fileKey, tomlContent string) *Scenario
- func (s *Scenario) Merge(version string) *Result
- func (s *Scenario) Migrate() *Result
- func (s *Scenario) MigrateDryRun() *Result
- func (s *Scenario) Migration(version, content string) *Scenario
- func (s *Scenario) MultiFile(files map[string]string, versionFile string) *Scenario
- func (s *Scenario) Rollback() *Result
- func (s *Scenario) RollbackDryRun() *Result
- func (s *Scenario) SingleFile(fileKey, relativePath string) *Scenario
- func (s *Scenario) StagingFile(name, content string) *Scenario
- func (s *Scenario) Status() *Result
- func (s *Scenario) Validate() *Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result holds the outcome of a scenario execution step.
func (*Result) AssertApplied ¶
AssertApplied asserts the number of migrations applied.
func (*Result) AssertError ¶
AssertError checks the error message contains a substring.
func (*Result) AssertErrors ¶ added in v0.3.0
AssertErrors checks the number of validation errors.
func (*Result) AssertExitCode ¶
AssertExitCode checks the exit code.
func (*Result) AssertFileExists ¶
AssertFileExists checks the file exists on disk.
func (*Result) AssertFileNotExists ¶
AssertFileNotExists checks the file does NOT exist on disk.
func (*Result) AssertHasKey ¶
AssertHasKey checks a key exists.
func (*Result) AssertMissingKey ¶
AssertMissingKey checks a key does NOT exist.
func (*Result) AssertOutputExists ¶ added in v0.3.0
AssertOutputExists checks that the merge output file exists on disk.
func (*Result) AssertPathExists ¶ added in v0.3.0
AssertPathExists checks that a path relative to the scenario dir exists.
func (*Result) AssertPending ¶
AssertPending checks the number of pending migrations (for Status results).
func (*Result) AssertSuccess ¶
AssertSuccess asserts no error.
func (*Result) AssertUntouched ¶
AssertUntouched checks file content is unchanged from before the step.
func (*Result) AssertVersion ¶
AssertVersion checks _schema_version in a file.
func (*Result) AssertWarnings ¶ added in v0.3.0
AssertWarnings checks the number of validation warnings.
type Scenario ¶
type Scenario struct {
// contains filtered or unexported fields
}
Scenario represents an isolated migration test environment.
func (*Scenario) Merge ¶ added in v0.3.0
Merge runs engine.Merge on the migrations directory with the given version.
func (*Scenario) MigrateDryRun ¶
MigrateDryRun runs migration in dry-run mode.
func (*Scenario) RollbackDryRun ¶
RollbackDryRun runs rollback in dry-run mode.
func (*Scenario) SingleFile ¶
SingleFile configures a single-file project.
func (*Scenario) StagingFile ¶ added in v0.3.0
StagingFile writes a staging file to migrations/next/<name>.toml.