Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Fixture for SSA is not able to deal with Objects that would be created in Apply #1201

Closed
jakobmoellerdev opened this issue Dec 27, 2022 · 1 comment

Comments

@jakobmoellerdev
Copy link

jakobmoellerdev commented Dec 27, 2022

The test fixtures in client-go were originally written without SSA in mind. Now that Apply Patch type needs to be supported, the fixture was changed by trying to force all changes to be computed via StrategicMerge in https://github.com/kubernetes/client-go/blob/master/testing/fixture.go#L184

However, because the fixture is trying to get the object from the list of mocked resources in https://github.com/kubernetes/client-go/blob/master/testing/fixture.go#L146, a typical SSA apply will fail if the object is not created. This leads to a difference in real/test behavior in the fixture as a normal SSA Apply in Kubernetes can deal with a missing resource by creating it, while it will fail in the test fixture (as the resource would not be present in the mocked objects).

I thus suggest to reimplement the Apply-Behavior in a way that is agnostic to SSA and that is able to deal with this scenario.

@jakobmoellerdev
Copy link
Author

Closing as duplicate of #1184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant