-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: reconnect, missing and duped events, remove max reconnect (#660)
Signed-off-by: Todd Baert <[email protected]>
- Loading branch information
Showing
21 changed files
with
207 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule flagd-testbed
updated
11 files
+14 −0 | .github/workflows/ci.yml | |
+21 −1 | .github/workflows/release-please.yml | |
+1 −1 | .release-please-manifest.json | |
+7 −0 | CHANGELOG.md | |
+1 −1 | flagd/Dockerfile | |
+12 −0 | flagd/Dockerfile.unstable | |
+10 −0 | gherkin/flagd-reconnect.feature | |
+0 −0 | scripts/change-flag-wrapper.sh | |
+28 −0 | scripts/restart-wrapper.sh | |
+1 −1 | sync/Dockerfile | |
+17 −0 | sync/Dockerfile.unstable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
libs/providers/flagd/src/e2e/step-definitions/flagd-reconnect.unstable.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { OpenFeature, ProviderEvents } from '@openfeature/server-sdk'; | ||
import { defineFeature, loadFeature } from 'jest-cucumber'; | ||
|
||
jest.setTimeout(30000); | ||
|
||
// load the feature file. | ||
const feature = loadFeature('features/flagd-reconnect.feature'); | ||
|
||
// get a client (flagd provider registered in setup) | ||
const client = OpenFeature.getClient('unstable'); | ||
|
||
defineFeature(feature, (test) => { | ||
let readyRunCount = 0; | ||
let errorRunCount = 0; | ||
|
||
beforeAll((done) => { | ||
client.addHandler(ProviderEvents.Ready, async () => { | ||
readyRunCount++; | ||
done(); | ||
}); | ||
}); | ||
|
||
test('Provider reconnection', ({ given, when, then, and }) => { | ||
given('a flagd provider is set', () => { | ||
// handled in beforeAll | ||
}); | ||
when('a PROVIDER_READY handler and a PROVIDER_ERROR handler are added', () => { | ||
client.addHandler(ProviderEvents.Error, () => { | ||
errorRunCount++; | ||
}); | ||
}); | ||
then('the PROVIDER_READY handler must run when the provider connects', async () => { | ||
// should already be at 1 from `beforeAll` | ||
expect(readyRunCount).toEqual(1); | ||
}); | ||
and("the PROVIDER_ERROR handler must run when the provider's connection is lost", async () => { | ||
await new Promise((resolve) => setTimeout(resolve, 10000)); | ||
expect(errorRunCount).toBeGreaterThan(0); | ||
}); | ||
and('when the connection is reestablished the PROVIDER_READY handler must run again', async () => { | ||
await new Promise((resolve) => setTimeout(resolve, 10000)); | ||
expect(readyRunCount).toBeGreaterThan(1); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { OpenFeature } from '@openfeature/server-sdk'; | ||
|
||
const tearDownTests = async () => { | ||
console.log('Shutting down OpenFeature...'); | ||
await OpenFeature.close(); | ||
}; | ||
|
||
export default tearDownTests; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export const BASE_EVENT_STREAM_RETRY_BACKOFF_MS = 1000; | ||
export const DEFAULT_MAX_EVENT_STREAM_RETRIES = 5; | ||
export const DEFAULT_MAX_EVENT_STREAM_RETRIES = Infinity; | ||
export const EVENT_CONFIGURATION_CHANGE = 'configuration_change'; | ||
export const EVENT_PROVIDER_READY = 'provider_ready'; | ||
export const DEFAULT_MAX_CACHE_SIZE = 1000; |
Oops, something went wrong.