flow
Search…
Tests
How to test your catalog's behavior
Tests verify the expected behavior of a catalog by allowing you to ingest sample documents and ensure that the expected output is produced.
1
# An object with tests to run, where each key is the name of a test, and the value is an array of
2
# test steps to execute.
3
tests:
4
# Test names can be anything.
5
'any old test name you want':
6
# Tests are defined as an array of steps, which will be executed in the order given.
7
# Each step may either ingest or verify. A test may include any number of steps with any
8
# combination of ingest and verify steps.
9
10
# An ingestion test step ingests document fixtures into the named collection.
11
- ingest:
12
13
# Name of the collection into which the test will ingest. Collection names consist of
14
# Unicode letters, numbers and symbols. Spaces and other special characters are disallowed.
15
collection: example/collection
16
17
# The documents to ingest. Each document must conform to the collections schema.
18
# Required, type: array
19
documents:
20
- foo: bar
21
baz: 1
22
23
# A verification step verifies that the contents of a named collection match the expected
24
# features, after fully processing all proceeding ingestion steps.
25
- verify:
26
27
# The name of the collection to verify
28
collection: example/collection
29
30
# Documents to verify. Each document may contain only a portion of the matched documents
31
# properties, and any properties present in the actual document but not in the document
32
# fixture will be ignored. All other values must match or the test will fail.
33
# Documents here must be provided in lexicographical order by key.
34
# Required, type: array
35
documents:
36
- foo: bar
37
baz: 1
38
39
# Selector over partitions to verify.
40
# type: object
41
partitions:
42
43
# Partition field names and corresponding values which must be matched from the source
44
# collection. Only documents having one of the specified values across all specified
45
# partition names will be matched. For example, source: [App, Web] region: [APAC] would
46
# mean only documents of ''App'' or ''Web'' source and also occurring in the ''APAC''
47
# region will be processed.
48
# type: object
49
include:
50
a_partition: ["A", "B"]
51
# Partition field names and values which are excluded from the source collection. Any
52
# documents matching *any one* of the partition values will be excluded.
53
exclude:
54
another_partition: [32, 64]
Copied!
An example test section can be found below:
1
tests:
2
examples:
3
- ingest:
4
collection: a/collection
5
documents:
6
- example: document
7
- another: document
8
- verify:
9
collection: a/collection
10
documents:
11
- expected: document
12
partitions:
13
include:
14
another_partition:
15
- A
16
- B
17
exclude:
18
a_partition:
19
- 32
20
- 64
Copied!
Last modified 6mo ago
Copy link