Input validation
Currently no validation is performed on the test input data - any checks are done by Snowflake itself.
Snowflake currently only enforces NOT NULL constraint corresponding to Depot required: true fields.
Furthermore, type casting is performed in Snowflake to match the defined field type.
Partial input
Sometimes it is convenient to only specify certain fields in the input data, e.g. if the test is not concerned with
the remaining values. However, if the schema specifies required: true on the other fields, the test will fail as
Snowflake will expect not-null values for the corresponding columns.
To support partial input testing scenario, it is possible to configure DepotTest.setContent() to make the input table
columns nullable for the specified required fields. This is done by setting dataValidation.requiredFields to
"NULLABLE":
const scenario = DepotTest.in(namespace)
.setContent({
dataUri: path.join(scenarioDirectory, "data"),
dataValidation: { requiredFields: "NULLABLE" }
});
Nullable fields can be configured both for file-based data URI and programmatic data, but only for setContent()
invocation.
Furthermore, if the seeded table is later used directly within the test steps
(e.g. as a direct transaction target/source, within assertions, etc), then the nullable config is ignored and
the table is initialised with NOT NULL constraints for required fields. This is to ensure that Depot transactions
and checks work correctly.