Repository navigation
What To Do If Integration Tests Fail
When an integration test fails, do not assume immediately that the example is broken.
In PAOFLOW, integration failures usually fall into one of these categories:
- a real behavioral regression
- missing or wrong test assets
- small numerical differences between the machine that generated the reference data and the machine running the test now
The goal is to determine which of those happened before changing code, references, or thresholds.
For the current QE integration workflow, failed tests generate comparison plots.
Those plots are useful because they show:
- the reference data
- the newly produced output
- the absolute difference between them
This is the fastest way to tell whether a failure is a true regression or just a small numerical drift.
If the QE integration job fails, the CI workflow uploads the plots as an artifact.
Look for the artifact named:
qe-comparison-plots
Download it and inspect the PNG files.
When run locally, the QE and transport integration tests write plots under a sandbox directory named:
_compare_plots
The test failure message prints the sandbox path, so developers can go directly to the generated plots.
Use the plots to answer a simple question:
Are the results qualitatively different, or are they nearly identical with only small numeric shifts?
These usually mean the code or inputs changed in a meaningful way:
- output and reference curves have clearly different shapes
- peaks move significantly
- an output file is missing
- extra output files appear unexpectedly
- the output and reference arrays have different sizes
- the difference plot is large over broad regions, not just tiny noise
These are often acceptable, especially when the references were generated on a different machine or with a different software stack:
- the output and reference curves visually overlap almost everywhere
- the difference plot is small and smooth
- the failure is limited to tiny deviations near steep features, crossings, or near-zero values
- the same code passes on one machine but fails on another with very small relative differences
If the curves are visually the same and the mismatch is minor, the issue may be numerical tolerance rather than a real regression.
Before changing anything, compare the environments.
Relevant differences include:
- CPU architecture
- BLAS/LAPACK implementation
- MPI library
- Python version
- NumPy / SciPy version
- compiler and math-library differences
- QE / VASP / other external-code versions used to generate the reference data
If the reference assets were generated on one machine and CI runs on another, small numeric differences are expected sometimes.
That does not automatically mean the threshold should be relaxed. It means the developer should first confirm that the discrepancy is only numerical.
The integration comparison logic checks *.dat files and compares the numeric columns against the reference data.
A few important details:
- the output and reference file lists must match exactly
- the data shapes must match
- the first column is treated as the x-axis and is not used directly in the error check
- the remaining columns are compared numerically using a tolerance
- QE and transport failures also generate per-file plots to help visual inspection
So if the failure is only a slight numeric drift, the plot and the reported error values will usually make that obvious.
If you inspect the plots and conclude that the output is still scientifically equivalent to the reference, you have two reasonable options.
This is the better choice if:
- the new output is still correct
- the change is expected and stable
- the old references are no longer representative
- you intentionally changed the algorithm or dependencies
In that case, regenerate the test assets and publish updated references.
This is appropriate only if:
- the output is visually and scientifically the same
- the mismatch is due to machine-to-machine numerical variation
- the current threshold is slightly too strict
- relaxing it will not hide real regressions
Do not increase tolerances blindly. Keep the change as small as possible and document why it was needed.
The threshold used by the CI workflow is currently defined in the integration test entrypoints.
At the moment, the tolerance is hardcoded as:
tolerance=0.01
That value is passed into the comparison helper from the suite-specific test file.
- QE integration tests: set in the QE test entrypoint
- transport integration tests: set in the transport test entrypoint
- TBmodel integration tests: set in the TBmodel test entrypoint
If CI is failing because of a confirmed machine-dependent numeric drift, update the tolerance in the relevant suite and rerun the tests.
The workflow itself is not reading this threshold from an environment variable right now; it gets the threshold from the test code that CI executes.
If you think the tolerance needs to be adjusted, use this process:
- inspect the plots first
- confirm that the difference is only numerical
- make the smallest threshold increase that resolves the failure
- rerun the failing suite locally
- rerun the CI workflow
- mention in the pull request that the threshold was adjusted due to machine-dependent numerical drift
A threshold change should always be evidence-based.
Do not change the threshold if any of the following are true:
- the plots show visibly different physics
- output files are missing or added unexpectedly
- shapes of the arrays differ
- the failure started after a logic change that could have affected the result
- the mismatch is large enough that you would not trust the result scientifically
In those cases, debug the code or regenerate references only after understanding the cause.
When an integration test fails:
- download the comparison plots from CI or open the local
_compare_plotsdirectory - read the failure message carefully
- confirm whether files are missing, extra, or shape-mismatched
- inspect whether the curves are qualitatively different
- decide whether the issue is:
- a real regression
- stale reference assets
- machine-dependent numerical drift
- only then choose between:
- fixing the code
- regenerating references
- slightly adjusting the tolerance