Skip to content

fix: selector not being sent in sync call #1220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
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