Atlas Testing
test migrate
The test "migrate" "name"
block describes a migrate test case.
test "migrate" "20240613061102" {
migrate {
to = "20240613061046"
}
exec {
sql = "INSERT INTO users (name) VALUES ('Ada Lovelace')"
}
migrate {
to = "20240613061102"
}
exec {
sql = "SELECT first_name,last_name FROM users"
output = "Ada, Lovelace"
}
}
Attributes
Name | Required | Value |
---|---|---|
skip | false | bool |
Blocks
test.assert
test.assert
attributes
Name | Required | Value |
---|---|---|
error_message | false | string |
sql | true | string |
test.assert
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
test.catch
test.catch
attributes
Name | Required | Value |
---|---|---|
error | false | string |
sql | true | string |
test.catch
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
test.exec
test.exec
attributes
Name | Required | Value |
---|---|---|
format | false |
|
match | false | string |
output | false | string |
sql | true | string |
test.exec
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [output, match] |
test.external
The external
allows executing external programs to insert data or run assertions on the dev-database used by test case.
external {
program = [
"go", "run", "seed.go",
"--dev-url", testing.dev_url,
]
}
test.external
attributes
Name | Required | Value |
---|---|---|
match | false | string |
output | false | string |
program | true | List of strings |
working_dir | false | string |
test.external
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [output, match] |
test.log
test.log
attributes
Name | Required | Value |
---|---|---|
message | true | string |
test.log
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
test.migrate
test.migrate
attributes
Name | Required | Value |
---|---|---|
to | true | string |
test.migrate
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
test schema
The test "schema" "name"
block describes a schema test case.
test "schema" "postal" {
parallel = true
exec {
sql = "SELECT '12345'::us_postal_code"
}
catch {
sql = "SELECT 'hello'::us_postal_code"
}
}
Attributes
Name | Required | Value |
---|---|---|
parallel | false | bool |
skip | false | bool |
Blocks
test.assert
test.assert
attributes
Name | Required | Value |
---|---|---|
error_message | false | string |
sql | true | string |
test.assert
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
test.catch
test.catch
attributes
Name | Required | Value |
---|---|---|
error | false | string |
sql | true | string |
test.catch
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
test.exec
test.exec
attributes
Name | Required | Value |
---|---|---|
format | false |
|
match | false | string |
output | false | string |
sql | true | string |
test.exec
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [output, match] |
test.external
The external
allows executing external programs to insert data or run assertions on the dev-database used by test case.
external {
program = [
"go", "run", "seed.go",
"--dev-url", testing.dev_url,
]
}
test.external
attributes
Name | Required | Value |
---|---|---|
match | false | string |
output | false | string |
program | true | List of strings |
working_dir | false | string |
test.external
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [output, match] |
test.log
test.log
attributes
Name | Required | Value |
---|---|---|
message | true | string |
test.log
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |