coralogix / zio-k8s

An idiomatic ZIO client for the Kubernetes API.
Apache License 2.0
97 stars 19 forks source link

Test Clients should increment generation on calls to `replace` when the `.spec` field has been modified. #431

Open gavares opened 1 year ago

gavares commented 1 year ago

TestResourceClient.replace currently has a check in place to increment the .metadata.resourceVersion version field but the .metadata.generation field is not incremented when there are changes to the .spec section of a CR. This leads to bad behavior while testing as certain patterns will compare generation and observedGeneration to determine if action should be taken.

According to discussions from the k8s dev team, generation:

Looking at TestResourceClient.replace, .metadata.resourceVersion is being incremented and an additional check and increment should probably be added to .metadata.generation as well.

vigoo commented 1 year ago

Thanks for the report and the detailed information on how it should work!