Skip to content

Commit

Permalink
fix: selector not being sent in sync call (#1220)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Schrottner <[email protected]>
  • Loading branch information
aepfli authored Feb 13, 2025
1 parent 34f83c5 commit 99e25ce
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,16 @@ public GrpcStreamConnector(final FlagdOptions options, Consumer<FlagdProviderEve
FlagSyncServiceGrpc::newStub,
FlagSyncServiceGrpc::newBlockingStub,
onConnectionEvent,
stub -> stub.syncFlags(SyncFlagsRequest.getDefaultInstance(), new GrpcStreamHandler(streamReceiver)));
stub -> {
String localSelector = selector;

final SyncFlagsRequest.Builder syncRequest = SyncFlagsRequest.newBuilder();
if (localSelector != null) {
syncRequest.setSelector(localSelector);
}

stub.syncFlags(syncRequest.build(), new GrpcStreamHandler(streamReceiver));
});
}

/** Initialize gRPC stream connector. */
Expand Down Expand Up @@ -98,14 +107,9 @@ void observeEventStream(final BlockingQueue<QueuePayload> writeTo, final AtomicB
Exception metadataException = null;

log.debug("Initializing sync stream request");
final SyncFlagsRequest.Builder syncRequest = SyncFlagsRequest.newBuilder();
final GetMetadataRequest.Builder metadataRequest = GetMetadataRequest.newBuilder();
GetMetadataResponse metadataResponse = GetMetadataResponse.getDefaultInstance();

if (selector != null) {
syncRequest.setSelector(selector);
}

try (CancellableContext context = Context.current().withCancellation()) {

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "dev.openfeature.contrib.providers.flagd.e2e.steps")
@ConfigurationParameter(key = OBJECT_FACTORY_PROPERTY_NAME, value = "io.cucumber.picocontainer.PicoFactory")
@IncludeTags("file")
@ExcludeTags({"unixsocket", "targetURI", "reconnect", "customCert"})
@ExcludeTags({"unixsocket", "targetURI", "reconnect", "customCert", "events"})
@Testcontainers
public class RunFileTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@IncludeEngines("cucumber")
@SelectDirectories("test-harness/gherkin")
// if you want to run just one feature file, use the following line instead of @SelectDirectories
// @SelectFile("test-harness/gherkin/connection.feature")
// @SelectFile("test-harness/gherkin/selector.feature")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "dev.openfeature.contrib.providers.flagd.e2e.steps")
@ConfigurationParameter(key = OBJECT_FACTORY_PROPERTY_NAME, value = "io.cucumber.picocontainer.PicoFactory")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public ProviderSteps(State state) {

@BeforeAll
public static void beforeAll() throws IOException {
State.resolverType = Config.Resolver.RPC;
sharedTempDir = Files.createDirectories(
Paths.get("tmp/" + RandomStringUtils.randomAlphanumeric(8).toLowerCase() + "/"));
container = new FlagdContainer()
Expand Down
2 changes: 1 addition & 1 deletion providers/flagd/test-harness

0 comments on commit 99e25ce

Please sign in to comment.