cool-easter-32542
06/06/2023, 10:21 AMset.
Another point is that if snapshotting testing is used it seems that snapshots in __snapshot__/ directory are ignored and any changes to tests or values in set section doesn't affect the tests run - it's still successful.
Pants version
2.15.1
OS
both
Additional info
1. Consider the following setup
# deployment_test.yaml
tests:
- it: checks correct number of replicas
asserts:
- equal:
path: spec.replicas
value: 2
values:
- general_values.yaml
# IF COMMENT `values` section and uncomment `set` - it works fine.
# set:
# replicaCount: 2
# BUILD
helm_unittest_tests(
sources=[
"*_test.yaml",
"general_values.yaml"
]
)
# general_values.yaml
replicaCount: 2
serviceAccount:
name: opa
The error occurs:
pants test ::
13:07:38.10 [INFO] Completed: Running Helm unittest suite awesome/tests/deployment_test.yaml
13:07:38.11 [ERROR] Completed: Run Helm Unittest - awesome/tests/deployment_test.yaml - failed (exit code 1).
### Chart [ awesome ] awesome
FAIL test deployment awesome/tests/deployment_test.yaml
- checks correct number of replicas
Error: open awesome/tests/general_values.yaml: no such file or directory
2. Snapshot testing is also behaves not as expected. So, according to the documentation you need to generate .snap file and put it into __snapshot__ directory. When test runs it compares the output value with the snapshot. While the manifest is generated during the run it doesn't seem to actually compare the result with the snapshot, because any changes to either to snapshot or to values in set section doesn't doesn't impact test results - it's always successful.
Might be related - #16532
* * *
I believe both cases are might be related to the same issue and it's related to missing logic on how unittests are integrated into pants. Though I might missing some piece of documentation as well, in that case would appreciate any help :)
pantsbuild/pantscool-easter-32542
06/07/2023, 2:47 PM