Skip to content

Conversation

@Diaphteiros
Copy link
Contributor

What this PR does / why we need it:
The Scheme() method of the Cluster type did return nil, if the internal cluster.Cluster was nil, even if the internal client.Client was not and returning a scheme would have been possible. The NewTestClusterFromClient constructor which can be used to construct a 'fake' Cluster for testing purposes returns exactly a Cluster instance where the internal cluster.Cluster is nil, but the internal client.Client is not.
The old implementation of the Scheme method therefore prevents any code from using it if said code is being tested with a Cluster constructed with the NewTestClusterFromClient function.

This PR fixes the problem by returning the internal client.Client's scheme as a fallback, if the internal cluster.Cluster is nil. The Scheme method should now only return nil, if both, the internal cluster and the internal client, are nil.

Which issue(s) this PR fixes:
None

Special notes for your reviewer:

Release note:

Improved the implementation of the `Cluster` type's `Scheme` method so it does not return `nil` for `Cluster`s created via `NewTestClusterFromClient`.

@Diaphteiros Diaphteiros merged commit 3272225 into main Jul 21, 2025
8 checks passed
@Diaphteiros Diaphteiros deleted the fix-cluster-scheme branch July 21, 2025 10:54
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

Successfully merging this pull request may close these issues.

3 participants