Skip to content

Commit 21a2c96

Browse files
authored
feat(firehose): Add Firehose client (#4182)
* feat(kinesis): fix retry logic for request-level errors * fix(kinesis): enable full flush for cache * Add record storage tests for id exclusion * Update flush api doc * Use retryAfter to enable full flush * Fix nonisolated actor warning in sqliterecordstorage init * Fix test warning * Adapt kinesis client config provider to underlying sdk configuration deprecation * Revert "Adapt kinesis client config provider to underlying sdk configuration deprecation" This reverts commit 4dc335c. * Firehose: Refactor recordcache (#4176) * Refactor recordcache for reuse in firehose client * Reexport recordcache types in kinesis client package * firehose: Add firehose client (#4178) * Refactor recordcache for reuse in firehose client * Reexport recordcache types in kinesis client package * Add firehose client * Make recordcache internal definitions package-level * Remove obsolete typealiases * Adapt kinesis e2e test to test both firehose and kinesis clients e2e (#4183) * Refactor recordcache for reuse in firehose client * Reexport recordcache types in kinesis client package * Add firehose client * Make recordcache internal definitions package-level * Remove obsolete typealiases * Adapt kinesis e2e test to test both firehose and kinesis clients e2e * Update integration test action and add firehose unit tests * Move test backend definition to readme * Add scheme files * Fix stream names * Add comments for tests * Add test comment format to agents.md * Further add comments to kinesis and firehose tests
1 parent c9a71d9 commit 21a2c96

68 files changed

Lines changed: 2854 additions & 1231 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/integ_test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
uses: ./.github/workflows/integ_test_analytics.yml
1919
secrets: inherit
2020

21-
kinesis-test:
22-
name: Kinesis Integration Tests
23-
uses: ./.github/workflows/integ_test_kinesis.yml
21+
kinesis-firehose-test:
22+
name: Kinesis & Firehose Integration Tests
23+
uses: ./.github/workflows/integ_test_kinesis_firehose.yml
2424
secrets: inherit
2525

2626
push-notifications-test:

.github/workflows/integ_test_kinesis.yml renamed to .github/workflows/integ_test_kinesis_firehose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Integration Tests | Kinesis
1+
name: Integration Tests | Kinesis & Firehose
22
on:
33
workflow_dispatch:
44
inputs:
@@ -19,8 +19,8 @@ permissions:
1919
contents: read
2020

2121
jobs:
22-
kinesis-integration-tests:
23-
name: Kinesis Integration Tests
22+
kinesis-firehose-integration-tests:
23+
name: Kinesis & Firehose Integration Tests
2424
strategy:
2525
fail-fast: false
2626
matrix:
@@ -32,7 +32,7 @@ jobs:
3232
with:
3333
scheme: AmplifyKinesisClientIntegrationTests
3434
platform: ${{ matrix.platform }}
35-
project_path: ./AmplifyClients/AmplifyKinesisClient/Tests/IntegrationTests/KinesisHostApp
35+
project_path: ./AmplifyClients/Tests/IntegrationTests/KinesisFirehoseClientHostApp
3636
resource_subfolder: kinesis
3737
timeout-minutes: 30
3838
secrets: inherit

.github/workflows/unit_test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ jobs:
7272
AWSCloudWatchLoggingPlugin,
7373
AWSCognitoAuthPlugin,
7474
AWSDataStorePlugin,
75+
AmplifyRecordCache,
7576
AmplifyKinesisClient,
77+
AmplifyFirehoseClient,
7678
AWSLocationGeoPlugin,
7779
AWSPredictionsPlugin,
7880
AWSPinpointAnalyticsPlugin,
@@ -100,7 +102,9 @@ jobs:
100102
{ scheme: AWSCloudWatchLoggingPlugin, flags: 'Logging_plugin_unit_test,unit_tests' },
101103
{ scheme: AWSCognitoAuthPlugin, flags: 'Auth_plugin_unit_test,unit_tests' },
102104
{ scheme: AWSDataStorePlugin, flags: 'DataStore_plugin_unit_test,unit_tests' },
105+
{ scheme: AmplifyRecordCache, flags: 'RecordCache_unit_test,unit_tests' },
103106
{ scheme: AmplifyKinesisClient, flags: 'Kinesis_plugin_unit_test,unit_tests' },
107+
{ scheme: AmplifyFirehoseClient, flags: 'Firehose_plugin_unit_test,unit_tests' },
104108
{ scheme: AWSLocationGeoPlugin, flags: 'Geo_plugin_unit_test,unit_tests' },
105109
{ scheme: AWSPredictionsPlugin, flags: 'Predictions_plugin_unit_test,unit_tests' },
106110
{ scheme: AWSPinpointAnalyticsPlugin, flags: 'Analytics_plugin_unit_test,unit_tests' },

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@ GraphQLWithIAMIntegrationTests-credentials.json
8282

8383
AWSDataStoreCategoryPluginIntegrationTests-amplifyconfiguration.json
8484
*.code-workspace
85+
AmplifyClients/Tests/IntegrationTests/KinesisFirehoseClientHostApp/infra/
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1640"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "AmplifyFirehoseClient"
18+
BuildableName = "AmplifyFirehoseClient"
19+
BlueprintName = "AmplifyFirehoseClient"
20+
ReferencedContainer = "container:">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
codeCoverageEnabled = "YES"
31+
onlyGenerateCoverageForSpecifiedTargets = "YES">
32+
<CodeCoverageTargets>
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "AmplifyFirehoseClient"
36+
BuildableName = "AmplifyFirehoseClient"
37+
BlueprintName = "AmplifyFirehoseClient"
38+
ReferencedContainer = "container:">
39+
</BuildableReference>
40+
</CodeCoverageTargets>
41+
<Testables>
42+
<TestableReference
43+
skipped = "NO">
44+
<BuildableReference
45+
BuildableIdentifier = "primary"
46+
BlueprintIdentifier = "AmplifyFirehoseClientTests"
47+
BuildableName = "AmplifyFirehoseClientTests"
48+
BlueprintName = "AmplifyFirehoseClientTests"
49+
ReferencedContainer = "container:">
50+
</BuildableReference>
51+
</TestableReference>
52+
</Testables>
53+
</TestAction>
54+
<LaunchAction
55+
buildConfiguration = "Debug"
56+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
57+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
launchStyle = "0"
59+
useCustomWorkingDirectory = "NO"
60+
ignoresPersistentStateOnLaunch = "NO"
61+
debugDocumentVersioning = "YES"
62+
debugServiceExtension = "internal"
63+
allowLocationSimulation = "YES">
64+
</LaunchAction>
65+
<ProfileAction
66+
buildConfiguration = "Release"
67+
shouldUseLaunchSchemeArgsEnv = "YES"
68+
savedToolIdentifier = ""
69+
useCustomWorkingDirectory = "NO"
70+
debugDocumentVersioning = "YES">
71+
<MacroExpansion>
72+
<BuildableReference
73+
BuildableIdentifier = "primary"
74+
BlueprintIdentifier = "AmplifyFirehoseClient"
75+
BuildableName = "AmplifyFirehoseClient"
76+
BlueprintName = "AmplifyFirehoseClient"
77+
ReferencedContainer = "container:">
78+
</BuildableReference>
79+
</MacroExpansion>
80+
</ProfileAction>
81+
<AnalyzeAction
82+
buildConfiguration = "Debug">
83+
</AnalyzeAction>
84+
<ArchiveAction
85+
buildConfiguration = "Release"
86+
revealArchiveInOrganizer = "YES">
87+
</ArchiveAction>
88+
</Scheme>
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1640"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "AmplifyRecordCache"
18+
BuildableName = "AmplifyRecordCache"
19+
BlueprintName = "AmplifyRecordCache"
20+
ReferencedContainer = "container:">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
codeCoverageEnabled = "YES"
31+
onlyGenerateCoverageForSpecifiedTargets = "YES">
32+
<CodeCoverageTargets>
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "AmplifyRecordCache"
36+
BuildableName = "AmplifyRecordCache"
37+
BlueprintName = "AmplifyRecordCache"
38+
ReferencedContainer = "container:">
39+
</BuildableReference>
40+
</CodeCoverageTargets>
41+
<Testables>
42+
<TestableReference
43+
skipped = "NO">
44+
<BuildableReference
45+
BuildableIdentifier = "primary"
46+
BlueprintIdentifier = "AmplifyRecordCacheTests"
47+
BuildableName = "AmplifyRecordCacheTests"
48+
BlueprintName = "AmplifyRecordCacheTests"
49+
ReferencedContainer = "container:">
50+
</BuildableReference>
51+
</TestableReference>
52+
</Testables>
53+
</TestAction>
54+
<LaunchAction
55+
buildConfiguration = "Debug"
56+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
57+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
launchStyle = "0"
59+
useCustomWorkingDirectory = "NO"
60+
ignoresPersistentStateOnLaunch = "NO"
61+
debugDocumentVersioning = "YES"
62+
debugServiceExtension = "internal"
63+
allowLocationSimulation = "YES">
64+
</LaunchAction>
65+
<ProfileAction
66+
buildConfiguration = "Release"
67+
shouldUseLaunchSchemeArgsEnv = "YES"
68+
savedToolIdentifier = ""
69+
useCustomWorkingDirectory = "NO"
70+
debugDocumentVersioning = "YES">
71+
<MacroExpansion>
72+
<BuildableReference
73+
BuildableIdentifier = "primary"
74+
BlueprintIdentifier = "AmplifyRecordCache"
75+
BuildableName = "AmplifyRecordCache"
76+
BlueprintName = "AmplifyRecordCache"
77+
ReferencedContainer = "container:">
78+
</BuildableReference>
79+
</MacroExpansion>
80+
</ProfileAction>
81+
<AnalyzeAction
82+
buildConfiguration = "Debug">
83+
</AnalyzeAction>
84+
<ArchiveAction
85+
buildConfiguration = "Release"
86+
revealArchiveInOrganizer = "YES">
87+
</ArchiveAction>
88+
</Scheme>

AGENTS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@ swift test --filter AWSCognitoAuthPluginUnitTests # Specific target
9797
- **Unit tests**: XCTest, defined in Package.swift (19 test targets)
9898
- **Integration tests**: Xcode host app projects under `AmplifyPlugins/<Category>/Tests/<Category>HostApp/`
9999
- **Conventions**: Mock via behavior protocols, use `AmplifyTestCommon` for shared utilities, `AmplifyAsyncTesting` for async helpers
100+
- **Test documentation**: Use Given/When/Then doc comments on all test methods:
101+
```swift
102+
/// Test description
103+
///
104+
/// - Given: ...
105+
/// - When:
106+
/// - ...
107+
/// - Then:
108+
/// - ...
109+
///
110+
func testSomething() async throws { ... }
111+
```
100112
- Every change requires new or updated tests
101113

102114
## Semver

0 commit comments

Comments
 (0)