Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 8 additions & 4 deletions providers/flagd/tests/evaluator_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ TEST_F(EvaluatorTest, ResolveBoolean_Success) {

sync_->TriggerUpdate(flags);

openfeature::EvaluationContext ctx;
openfeature::EvaluationContext ctx =
openfeature::EvaluationContext::Builder().build();
Comment thread
m-olko marked this conversation as resolved.
auto result = evaluator_->ResolveBoolean("my-bool-flag", false, ctx);

EXPECT_EQ(result->GetValue(), true);
Expand All @@ -54,7 +55,8 @@ TEST_F(EvaluatorTest, ResolveBoolean_FlagNotFound) {
nlohmann::json flags = {{"flags", {}}};
sync_->TriggerUpdate(flags);

openfeature::EvaluationContext ctx;
openfeature::EvaluationContext ctx =
openfeature::EvaluationContext::Builder().build();
Comment thread
m-olko marked this conversation as resolved.
auto result = evaluator_->ResolveBoolean("missing-flag", true, ctx);

EXPECT_EQ(result->GetValue(), true); // Default value
Expand All @@ -72,7 +74,8 @@ TEST_F(EvaluatorTest, ResolveBoolean_TypeMismatch) {

sync_->TriggerUpdate(flags);

openfeature::EvaluationContext ctx;
openfeature::EvaluationContext ctx =
openfeature::EvaluationContext::Builder().build();
Comment thread
m-olko marked this conversation as resolved.
auto result = evaluator_->ResolveBoolean("my-string-flag", false, ctx);

EXPECT_EQ(result->GetValue(), false); // Default value
Expand All @@ -89,7 +92,8 @@ TEST_F(EvaluatorTest, ResolveBoolean_VariantNotFound) {

sync_->TriggerUpdate(flags);

openfeature::EvaluationContext ctx;
openfeature::EvaluationContext ctx =
openfeature::EvaluationContext::Builder().build();
Comment thread
m-olko marked this conversation as resolved.
auto result = evaluator_->ResolveBoolean("my-broken-flag", false, ctx);

EXPECT_EQ(result->GetValue(), false); // Default value
Expand Down
5 changes: 4 additions & 1 deletion providers/flagd/tests/smoke/grpc_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
int main() {
flagd::GrpcSync test = flagd::GrpcSync(flagd::FlagdProviderConfig());

test.Init(openfeature::EvaluationContext()).IgnoreError();
openfeature::EvaluationContext ctx =
openfeature::EvaluationContext::Builder().build();

test.Init(ctx).IgnoreError();
Comment thread
m-olko marked this conversation as resolved.

for (int i = 0; i < 20; i++) {
auto config = test.GetFlags();
Expand Down
5 changes: 4 additions & 1 deletion providers/flagd/tests/smoke/openfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ TEST(FlagdProviderTest, ProviderCreation) {
std::shared_ptr<openfeature::FeatureProvider> provider =
std::make_shared<flagd::FlagdProvider>(config);

openfeature::EvaluationContext ctx =
openfeature::EvaluationContext::Builder().build();

std::unique_ptr<openfeature::BoolResolutionDetails> details =
provider->GetBooleanEvaluation("test_flag", false, {});
provider->GetBooleanEvaluation("test_flag", false, ctx);
Comment thread
m-olko marked this conversation as resolved.

// We didn't call Init, so the provider is not ready.
auto expected_details = openfeature::BoolResolutionDetails{
Expand Down
6 changes: 4 additions & 2 deletions providers/flagd/tests/smoke/sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ TEST_F(FlagSyncTest, HelperMethodsUpdateAndRetrieveFlags) {
}

TEST_F(FlagSyncTest, InitAndShutdownReturnOk) {
openfeature::EvaluationContext ctx;
openfeature::EvaluationContext ctx =
openfeature::EvaluationContext::Builder().build();
Comment thread
m-olko marked this conversation as resolved.
EXPECT_CALL(sync_, Init(testing::_))
.WillOnce(testing::Return(absl::OkStatus()));
EXPECT_CALL(sync_, Shutdown()).WillOnce(testing::Return(absl::OkStatus()));
Expand Down Expand Up @@ -143,7 +144,8 @@ TEST_F(FlagSyncTest, ThreadSafety_ReadersAndWriters) {
TEST(GrpcSyncTest, InitTwiceDoesNotCrash) {
flagd::FlagdProviderConfig config;
flagd::GrpcSync sync(config);
openfeature::EvaluationContext ctx;
openfeature::EvaluationContext ctx =
openfeature::EvaluationContext::Builder().build();

// First call might fail because no server is running, but it shouldn't crash
auto status1 = sync.Init(ctx);
Expand Down
Loading