HoustonPutman opened a new pull request, #934: URL: https://github.com/apache/solr-operator/pull/934
Builds on #933, so it includes that PR's commit until it is merged. Only the second commit is new here, and it only changes tests, the Makefile, the CI workflow and the development docs. ### Catching Updates that change nothing Every Update the operator sends should change the resource it is sent for. One that doesn't means the operator's comparison misses a default that Kubernetes fills in, so the operator would send that same Update on every reconcile. The API server skips writing such an Update and doesn't bump the `resourceVersion`. So comparing objects before and after can't catch this; the requests themselves have to be checked. The reconcilers' client in the envtest suite now records every Update that leaves the `resourceVersion` unchanged. A suite-wide `AfterEach` fails any spec that sent one, with a message pointing at the `Update required because field changed` log that names the field. This makes every existing spec part of the check. With #933 reverted, it fails existing specs on `defaultMode` and `sessionAffinityConfig` without any new specs. ### Covering every option The existing fixtures fill in Kubernetes' defaults themselves, e.g. probe timeouts and `apiVersion: v1` on field refs, which is why they never caught this. So there are new fixtures: - **`every_option_fixtures_test.go`**: SolrClouds and SolrPrometheusExporters that between them set every option of the CRDs. They're spread over five SolrCloud and three exporter variants, because some options can't be combined, e.g. persistent and ephemeral storage, a provided ZooKeeper or a connection string, Ingress or ExternalDNS, and PKCS12 or mounted TLS. Wherever they pass Kubernetes types through, they deliberately leave out the fields Kubernetes defaults, with a volume of every kind that gets defaults, probes of every handler, lifecycle hooks, sidecars and native sidecar init containers. - **`no_repeated_updates_test.go`**: creates each variant, waits for the operator to stop writing, makes it reconcile once more, and then checks each type of resource the operator creates in its own spec: the CR itself, StatefulSet, Services, ConfigMap, Ingress, PodDisruptionBudget and ZookeeperCluster, or Deployment, Service and ConfigMap for exporters. A last spec catches Updates to any other resource. - **`every_option_coverage_test.go`**: a plain Go test, which doesn't need envtest. It walks the SolrCloud and SolrPrometheusExporter spec types by reflection and fails for any field that no variant sets. So adding an option to the CRDs means adding it to a fixture. It walks into the solr-operator API types and only requires Kubernetes types, e.g. a `corev1.Probe`, to be set. These specs found most of the fields fixed in #933. ### Test output `make unit-tests` now also saves the full test output to `tests/unit/output/unit-tests.log`, and Ginkgo's `junit.xml` and `report.json` for the controller tests, like the e2e tests do. The directory is gitignored and recreated on every run, and the CI uploads it when the tests fail. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
