Skip to content

Support keys and configs in SplitClientForTest#596

Open
GreyTeardrop wants to merge 3 commits intosplitio:masterfrom
GreyTeardrop:test-client-key-result
Open

Support keys and configs in SplitClientForTest#596
GreyTeardrop wants to merge 3 commits intosplitio:masterfrom
GreyTeardrop:test-client-key-result

Conversation

@GreyTeardrop
Copy link
Copy Markdown

SplitClientForTest can be useful for unit-testing code that depends on SplitClient, especially in dynamic scenarios where a static config per test class won't work. As of now, SplitClientForTest doesn't support customization of split keys or configs - it always returns the same treatment for all keys of a feature flag and always returns null as a split config.

This change extends SplitClientForTest, so it's possible to set treatments for each feature flag and key, and also possible to set split config in addition to the treatment name.

SplitClientForTest can be useful for unit-testing code that depends on
SplitClient, especially in dynamic scenarios where a static config per
test class won't work. As of now, SplitClientForTest doesn't support
customization of split keys or configs - it always returns the same
treatment for all keys of a feature flag and always returns null as a
split config.

This change extends SplitClientForTest, so it's possible to set
treatments for each feature flag and key, and also possible to set split
config in addition to the treatment name.
@GreyTeardrop GreyTeardrop requested a review from a team as a code owner August 29, 2025 12:03
@GreyTeardrop
Copy link
Copy Markdown
Author

@chillaq is this a change you might be interested in reviewing?

@GreyTeardrop
Copy link
Copy Markdown
Author

@nmayorsplit any chance you could take a look at this change?

@NicoZelaya NicoZelaya self-requested a review April 2, 2026 21:37
@NicoZelaya NicoZelaya self-assigned this Apr 2, 2026
@NicoZelaya
Copy link
Copy Markdown
Contributor

Hello @GreyTeardrop ! I'm Nico from Harness FME and I work with the SDK team.

First of all I'd like to apologize for the lack of response from our end. Then also thank you for your contribution! I agree this would be useful for unit testing and a good addition to this submodule.
I wanted to let you know that I have assigned this one to myself and will be re-distributing it next week, we'll reach out through our CS team if we have any questions.

Most likely will ask the team to make a few changes like avoiding the type change on the return for .tests() method for backwards compatibility and once we have it in good shape, we'll most likely merge it in!
Once we have a better assessment by end of next week (or earlier) we'll reach out to let you know what to expect.

Once more, thank you for your contribution and feedback!

Best regards,
Nico Zelaya.

Fix compatibility for the SplitClientForTest.tests() method.
Keep it with the old signature, expose new complete mappings via
testMappings() method.
@GreyTeardrop
Copy link
Copy Markdown
Author

Thank you, @NicoZelaya! I've adjusted the code a bit to keep it as compatible as possible. There should no longer be breaking changes in method signatures. There's technically still a potentially breaking change, as previously SplitClientForTest.tests() exposed a mutable internal representation, but now it can only expose a copy that doesn't affect its internal state.

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.

2 participants