Open emerkle826 opened 1 year ago
I don't think that ticket you linked is the reason, as this test works fine 4.30.6. I'm not even sure if we've used the older version ever in these tests.
So, on my machine (tm) this test still works?
Here's the manual output also:
➜ k8ssandra-operator git:(main) /usr/local/bin/yq ea '.spec.cassandra.datacenters.[] as $item ireduce (0; . +1)' test/testdata/fixtures/multi-dc/k8ssandra.yaml test/testdata/fixtures/single-dc/k8ssandra.yaml
3
➜ k8ssandra-operator git:(main) yq --version
yq (https://github.com/mikefarah/yq/) version v4.30.6
➜ k8ssandra-operator git:(main)
Interesting. On my machine (yq version 4.30.8) I get the same duplicated output when using the ea
option:
yq ea '.spec.cassandra.datacenters.[] as $item ireduce (0; . +1)' test/testdata/fixtures/multi-dc/k8ssandra.yaml test/testdata/fixtures/single-dc/k8ssandra.yaml
3
3
[emerkle@erik-datastax k8ssandra-operator]$ yq --version
yq (https://github.com/mikefarah/yq/) version v4.30.8
Continuing the discussion from https://github.com/k8ssandra/k8ssandra-operator/pull/812
This ticket was linked: https://github.com/mikefarah/yq/issues/1515
But that's not exactly the issue with the test. The test uses the eval-all
option. It seems that the test expects the eval-all
option to run the expression once over the merged set of input files. The ticket referenced does not use the eval-all
option, so the expression is run on each input file.
I guess the question is how is the eval-all
option supposed to work in the situation we are using it, and do we need to change how we are using it?
What happened?
yq
test is failing when using theeval-all
option. Example:Did you expect to see something different? The test expects all input files to be processed once. So in the example above, it's trying to count the number of datacenters defined in 2 different files. One file has 2 DCs defined, the other has only 1. With the
eval-all
option, the output is expected to be 3. With newer versions ofyq
the output is repeated for the number of input files, so we now get:This test was passing as recently as yesterday (from the time of writing this ticket): https://github.com/k8ssandra/k8ssandra-operator/actions/runs/3956583819/jobs/6776181660
There seems to be a bug reporting this issue: https://github.com/mikefarah/yq/issues/1206
How to reproduce it (as minimally and precisely as possible): See the test failure above.
┆Issue is synchronized with this Jira Story by Unito