Skip to main content

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

NameRequiredValue
skipfalsebool

Blocks

test.assert

test.assert attributes
NameRequiredValue
error_messagefalsestring
sqltruestring
test.assert constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse

test.catch

test.catch attributes
NameRequiredValue
errorfalsestring
sqltruestring
test.catch constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse

test.exec

test.exec attributes
NameRequiredValue
formatfalse

enum (csv, table)

matchfalsestring
outputfalsestring
sqltruestring
test.exec constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse
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
NameRequiredValue
matchfalsestring
outputfalsestring
programtrue

List of strings

working_dirfalsestring
test.external constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse
Mutually exclusive sets[output, match]

test.log

test.log attributes
NameRequiredValue
messagetruestring
test.log constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse

test.migrate

test.migrate attributes
NameRequiredValue
totruestring
test.migrate constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse

Constraints

ConstraintValue
Requiredfalse
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

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

NameRequiredValue
parallelfalsebool
skipfalsebool

Blocks

test.assert

test.assert attributes
NameRequiredValue
error_messagefalsestring
sqltruestring
test.assert constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse

test.catch

test.catch attributes
NameRequiredValue
errorfalsestring
sqltruestring
test.catch constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse

test.exec

test.exec attributes
NameRequiredValue
formatfalse

enum (csv, table)

matchfalsestring
outputfalsestring
sqltruestring
test.exec constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse
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
NameRequiredValue
matchfalsestring
outputfalsestring
programtrue

List of strings

working_dirfalsestring
test.external constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse
Mutually exclusive sets[output, match]

test.log

test.log attributes
NameRequiredValue
messagetruestring
test.log constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Allow unknown blocksfalse
Allow unknown attributesfalse

Constraints

ConstraintValue
Requiredfalse
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse