Skip to content

Commit 77961c8

Browse files
committed
Merge branch 'main' into feat/gherkinmigration
Signed-off-by: Simon Schrottner <[email protected]>
2 parents 58fee96 + 02dcfc0 commit 77961c8

File tree

12 files changed

+42
-55
lines changed

12 files changed

+42
-55
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
submodules: recursive
3838

3939
- name: Set up Python ${{ matrix.python-version }}
40-
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
40+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
4141
with:
4242
python-version: ${{ matrix.python-version }}
4343
cache: "pip"
@@ -60,7 +60,7 @@ jobs:
6060

6161
- if: matrix.python-version == '3.11'
6262
name: Upload coverage to Codecov
63-
uses: codecov/codecov-action@5a605bd92782ce0810fa3b8acc235c921b497052 # v5.2.0
63+
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
6464
with:
6565
name: Code Coverage for ${{ matrix.package }} on Python ${{ matrix.python-version }}
6666
directory: ${{ matrix.package }}
@@ -73,7 +73,7 @@ jobs:
7373

7474
steps:
7575
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
76-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
76+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
7777
with:
7878
python-version: "3.11"
7979
cache: "pip"
@@ -91,10 +91,10 @@ jobs:
9191
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
9292

9393
- name: Initialize CodeQL
94-
uses: github/codeql-action/init@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3
94+
uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3
9595
with:
9696
languages: python
9797
config-file: ./.github/codeql-config.yml
9898

9999
- name: Perform CodeQL Analysis
100-
uses: github/codeql-action/analyze@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3
100+
uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
with:
5252
submodules: recursive
5353

54-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
54+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
5555
with:
5656
python-version: '3.13'
5757

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
default_stages: [commit]
22
repos:
33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: v0.9.2
4+
rev: v0.9.4
55
hooks:
66
- id: ruff
77
args: [--fix]

providers/openfeature-provider-flagd/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ keywords = []
1919
dependencies = [
2020
"openfeature-sdk>=0.6.0",
2121
"grpcio>=1.68.1",
22-
"protobuf>=4.25.2",
22+
"protobuf>=4.29.2",
2323
"mmh3>=4.1.0",
2424
"panzi-json-logic>=1.0.1",
2525
"semver>=3,<4",
@@ -40,7 +40,7 @@ dependencies = [
4040
"pytest-bdd",
4141
"testcontainers",
4242
"asserts",
43-
"grpcio-health-checking==1.69.0",
43+
"grpcio-health-checking==1.70.0",
4444
]
4545
pre-install-commands = [
4646
"hatch build",

providers/openfeature-provider-flagd/pytest.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
[pytest]
22
markers =
33
rpc: tests for rpc mode.
4-
in-process: tests for rpc mode.
4+
in-process: tests for in-process mode.
5+
file: tests for file mode.
6+
unavailable: tests for unavailable providers.
57
customCert: Supports custom certs.
68
unixsocket: Supports unixsockets.
79
targetURI: Supports targetURI.
@@ -15,4 +17,6 @@ markers =
1517
sync: Supports sync.
1618
caching: Supports caching.
1719
offline: Supports offline.
20+
os.linux: linux mark.
21+
stream: Supports streams.
1822
bdd_features_base_dir = tests/features

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727
from openfeature.evaluation_context import EvaluationContext
2828
from openfeature.flag_evaluation import FlagResolutionDetails
29+
from openfeature.provider import AbstractProvider
2930
from openfeature.provider.metadata import Metadata
30-
from openfeature.provider.provider import AbstractProvider
3131

3232
from .config import CacheType, Config, ResolverType
3333
from .resolvers import AbstractResolver, GrpcResolver, InProcessResolver

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/grpc.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ def initialize(self, evaluation_context: EvaluationContext) -> None:
105105

106106
def shutdown(self) -> None:
107107
self.active = False
108+
self.channel.unsubscribe(self._state_change_callback)
108109
self.channel.close()
110+
if self.timer and self.timer.is_alive():
111+
logger.debug("gRPC error timer cancelled due to shutdown")
112+
self.timer.cancel()
109113
if self.cache:
110114
self.cache.clear()
111115

@@ -185,14 +189,16 @@ def listen(self) -> None:
185189
while self.active:
186190
try:
187191
logger.debug("Setting up gRPC sync flags connection")
188-
for message in self.stub.EventStream(request, **call_args):
192+
for message in self.stub.EventStream(
193+
request, wait_for_ready=True, **call_args
194+
):
189195
if message.type == "provider_ready":
190-
self.connected = True
191196
self.emit_provider_ready(
192197
ProviderEventDetails(
193198
message="gRPC sync connection established"
194199
)
195200
)
201+
self.connected = True
196202
elif message.type == "configuration_change":
197203
data = MessageToDict(message)["data"]
198204
self.handle_changed_flags(data)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import typing
2+
3+
from openfeature.evaluation_context import EvaluationContext
4+
5+
6+
class FlagStateConnector(typing.Protocol):
7+
def initialize(
8+
self, evaluation_context: EvaluationContext
9+
) -> None: ... # pragma: no cover
10+
11+
def shutdown(self) -> None: ... # pragma: no cover

providers/openfeature-provider-flagd/tests/e2e/step/event_steps.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ def handler(event):
4444
def assert_handlers(handles, event_type: str, max_wait: int = 2):
4545
poll_interval = 1
4646
while max_wait > 0:
47-
found = [h["type"] == event_type for h in handles]
47+
found = any(h["type"] == event_type for h in handles)
4848
if not found:
4949
max_wait -= poll_interval
5050
time.sleep(poll_interval)
5151
continue
5252
break
53-
return [h for h in handles if h["type"] == event_type]
53+
return handles
5454

5555

5656
@when(
@@ -60,7 +60,8 @@ def assert_handlers(handles, event_type: str, max_wait: int = 2):
6060
target_fixture="event_details",
6161
)
6262
def pass_for_event_fired(event_type: str, event_handles):
63-
events = assert_handlers(event_handles, event_type, 20)
63+
events = assert_handlers(event_handles, event_type, 30000)
64+
events = [e for e in events if e["type"] == event_type]
6465
assert_greater(len(events), 0)
6566
for event in event_handles:
6667
event_handles.remove(event)

0 commit comments

Comments
 (0)