Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

fix: fixes issue where first flag listener callback was not triggered… #97

Merged
merged 4 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/start-contract-test-service.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
cd contract-tests && dotnet bin/Debug/${TESTFRAMEWORK:-net6.0}/ContractTestService.dll
cd contract-tests && dotnet bin/Debug/${TESTFRAMEWORK:-net7.0}/ContractTestService.dll
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ public void Init(Context context, FullDataSet data)
_dataStore.Init(context, data, true);

ImmutableDictionary<string, FeatureFlag> oldValues, newValues;
var contextKey = context.FullyQualifiedKey;
lock (_lastValuesLock)
{
_lastValues.TryGetValue(context.Key, out oldValues);
_lastValues.TryGetValue(contextKey, out oldValues);
var builder = ImmutableDictionary.CreateBuilder<string, FeatureFlag>();
foreach (var newEntry in data.Items)
{
Expand All @@ -65,7 +66,7 @@ public void Init(Context context, FullDataSet data)
}
}
newValues = builder.ToImmutable();
_lastValues = _lastValues.SetItem(context.Key, newValues);
_lastValues = _lastValues.SetItem(contextKey, newValues);
}

UpdateStatus(DataSourceState.Valid, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ public class DataSourceUpdateSinkImplTest : BaseTest
private readonly FlagDataManager _store;
private readonly FlagTrackerImpl _flagTracker;
private readonly DataSourceUpdateSinkImpl _updateSink;
private readonly Context _basicUser = Context.New("user-key");
private readonly Context _otherUser = Context.New("other-key");

private readonly Context _basicUser = Context.NewMulti(Context.New(ContextKind.Of("user"), "user-key1"), Context.New(ContextKind.Of("custom-kind"), "custom-key1"));
private readonly Context _otherUser = Context.NewMulti(Context.New(ContextKind.Of("user"), "user-key2"), Context.New(ContextKind.Of("custom-kind"), "custom-key2"));
Copy link
Contributor Author

@tanderson-ld tanderson-ld Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reviewers: Using multi-contexts in the test here causes the tests to fail without the fix, so this is sufficient test coverage now.


public DataSourceUpdateSinkImplTest(ITestOutputHelper testOutput) : base(testOutput)
{
Expand Down
Loading