public class FileVerifier extends Object
The test works by comparing the actual EXPLAIN output
to a "golden" file with the expected ("golden") plan.
To create a test, just write it and let it fail due to a missing file. The output will go to the console. Inspect it. If it looks good, copy the plan to the golden file and run again.
If comparison fails, you can optionally ask the verifier to write the
output to /tmp/drill/test so you can compare the golden and actual
outputs using your favorite diff tool to understand changes. If the changes
are expected, use that same IDE to copy changes from the actual
to the golden file.
The JSON properties of the serialized classes are all controlled
to have a fixed order to ensure that files compare across test
runs. If you see spurious failures do to changed JSON order, consider
adding a @JsonPropertyOrder tag to enforce a consistent order.
Lines can be prefixed with "!" to indicate that they are a regex. The pattern "!!" is treated as a non-regex line that starts with a bang. The pattern "!\!" is a regex that starts with a bang.
| Constructor and Description |
|---|
FileVerifier(String goldenFileDir) |
| Modifier and Type | Method and Description |
|---|---|
void |
verify(String actual,
File resource) |
void |
verifyFiles(File actual,
File resource) |
void |
verifyFileWithResource(File actual,
String relativePath) |
Copyright © 2021 The Apache Software Foundation. All rights reserved.