Skip to content

Commit 6aa00ee

Browse files
Merge pull request #835 from splitio/periodicRecorderWorker-module
Periodic recorder worker module
2 parents 7aec5ed + eb85752 commit 6aa00ee

97 files changed

Lines changed: 8697 additions & 7393 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.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and Test Modules UT
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
destination:
7+
required: true
8+
type: string
9+
scheme:
10+
description: The Xcode scheme to build and test (ModulesTestsSwift5 or ModulesTestsSwift6)
11+
required: true
12+
type: string
13+
14+
jobs:
15+
test:
16+
runs-on: [macos-15-xlarge]
17+
18+
steps:
19+
- name: Select Xcode
20+
uses: maxim-lobanov/setup-xcode@v1
21+
with:
22+
xcode-version: 16
23+
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Install xcbeautify
30+
run: brew install xcbeautify
31+
32+
- name: Build and Test Modules
33+
uses: nick-fields/retry@v3
34+
with:
35+
timeout_minutes: 15
36+
max_attempts: 3
37+
command: |
38+
set -o pipefail
39+
xcodebuild test \
40+
-project Split.xcodeproj \
41+
-scheme ${{ inputs.scheme }} \
42+
-destination '${{ inputs.destination }}' \
43+
-testPlan TestPlans/ModulesTests \
44+
-sdk iphonesimulator \
45+
ONLY_ACTIVE_ARCH=NO | xcbeautify

.github/workflows/sonar.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
xcodebuild -quiet test \
3131
-project Split.xcodeproj \
3232
-scheme Split \
33-
-testPlan "SplitiOSFull" \
33+
-testPlan "TestPlans/SplitiOSFull" \
3434
-destination 'platform=iOS Simulator,OS=18.5,name=iPhone 16' \
3535
-enableCodeCoverage YES \
3636
-resultBundlePath build/Logs/Test/TestResults.xcresult \

.github/workflows/test_all.yaml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ jobs:
1717
strategy:
1818
matrix:
1919
plan: [
20-
SplitiOSIntegration,
21-
SplitiOSIntegration_1,
22-
SplitiOSStreaming,
23-
SplitiOSStreaming_1,
24-
SplitiOSStreaming_2,
25-
SplitiOSUnit,
26-
SplitiOSUnit_1,
27-
SplitiOSUnit_2,
28-
SplitiOSUnit_3,
29-
SplitiOSUnit_4,
30-
SplitiOSUnit_5,
31-
SemVer,
32-
SplitPushManagerUT,
33-
SplitStreamingUT,
34-
SplitFlakyTests
20+
TestPlans/SplitiOSIntegration,
21+
TestPlans/SplitiOSIntegration_1,
22+
TestPlans/SplitiOSStreaming,
23+
TestPlans/SplitiOSStreaming_1,
24+
TestPlans/SplitiOSStreaming_2,
25+
TestPlans/SplitiOSUnit,
26+
TestPlans/SplitiOSUnit_1,
27+
TestPlans/SplitiOSUnit_2,
28+
TestPlans/SplitiOSUnit_3,
29+
TestPlans/SplitiOSUnit_4,
30+
TestPlans/SplitiOSUnit_5,
31+
TestPlans/SemVer,
32+
TestPlans/SplitPushManagerUT,
33+
TestPlans/SplitStreamingUT,
34+
TestPlans/SplitFlakyTests
3535
]
3636
scheme: [SplitTestsSwift5, SplitTestsSwift6]
3737
fail-fast: false
@@ -40,3 +40,13 @@ jobs:
4040
test-plan: ${{ matrix.plan }}
4141
destination: 'platform=iOS Simulator,OS=18.5,name=iPhone 16'
4242
scheme: ${{ matrix.scheme }}
43+
44+
modules-test:
45+
strategy:
46+
matrix:
47+
scheme: [ModulesTestsSwift5, ModulesTestsSwift6]
48+
fail-fast: false
49+
uses: ./.github/workflows/base_modules_ut.yaml
50+
with:
51+
destination: 'platform=iOS Simulator,OS=18.5,name=iPhone 16'
52+
scheme: ${{ matrix.scheme }}

Package.swift

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ let package = Package(
88
products: [
99
.library(name: "Split", targets: ["Split"]),
1010

11-
.library(name: "SplitCommons", targets: ["Logging", "Http", "BackoffCounter"]),],
11+
.library(name: "SplitCommons", targets: ["Logging", "Http", "BackoffCounter", "PeriodicRecorderWorker"]),],
1212
targets: [
13+
14+
// MARK: Split
1315
.target(
1416
name: "Split",
15-
dependencies: ["Http", "BackoffCounter", "Logging"],
17+
dependencies: ["Http", "BackoffCounter", "Logging", "PeriodicRecorderWorker"],
1618
path: "Split",
1719
exclude: [
1820
"Common/Yaml/LICENSE",
@@ -21,6 +23,8 @@ let package = Package(
2123
]
2224
),
2325

26+
// MARK: External Modules
27+
// Logging
2428
.target(
2529
name: "Logging",
2630
dependencies: [],
@@ -33,6 +37,7 @@ let package = Package(
3337
path: "Sources/Logging/Tests"
3438
),
3539

40+
// Http
3641
.target(
3742
name: "Http",
3843
dependencies: ["Logging"],
@@ -45,6 +50,7 @@ let package = Package(
4550
path: "Sources/Http/Tests"
4651
),
4752

53+
// BackoffCounter
4854
.target(
4955
name: "BackoffCounter",
5056
dependencies: ["Logging"],
@@ -53,9 +59,22 @@ let package = Package(
5359
),
5460
.testTarget(
5561
name: "BackoffCounterTests",
56-
dependencies: ["BackoffCounter"],
62+
dependencies: [],
5763
path: "Sources/BackoffCounter/Tests"
5864
),
65+
66+
// PeriodicRecorderWorker
67+
.target(
68+
name: "PeriodicRecorderWorker",
69+
dependencies: [],
70+
path: "Sources/PeriodicRecorderWorker",
71+
exclude: ["Tests", "README.md"]
72+
),
73+
.testTarget(
74+
name: "PeriodicRecorderWorkerTests",
75+
dependencies: ["PeriodicRecorderWorker"],
76+
path: "Sources/PeriodicRecorderWorker/Tests"
77+
),
5978
// #INJECT_TARGET
6079
]
6180
)

Sources/BackoffCounter/BackoffCounter.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class DefaultBackoffCounter: BackoffCounter, @unchecked Sendable {
2323
}
2424
}
2525

26+
@discardableResult
2627
public func getNextRetryTime() -> Double {
2728
lock.lock()
2829
let currentAttempt = attemptCount

Sources/BackoffCounter/Tests/BackoffCounterTest.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
// Copyright © 2020 Split. All rights reserved.
44

55
import Foundation
6-
76
import XCTest
8-
@testable import Split
7+
@testable import BackoffCounter
98

109
class BackoffCounterTest: XCTestCase {
1110

@@ -37,7 +36,7 @@ class BackoffCounterTest: XCTestCase {
3736
let v4 = counter.getNextRetryTime()
3837

3938
for _ in 0..<2000 {
40-
_ = counter.getNextRetryTime()
39+
counter.getNextRetryTime()
4140
}
4241
let vMax = counter.getNextRetryTime()
4342
counter.resetCounter();

Sources/Http/Endpoint.swift

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
//
2-
// Endpoint.swift
3-
// Http
4-
//
5-
// Created by Javier L. Avrudsky on 13/05/2020.
6-
// Copyright (c) 2020 Split. All rights reserved.
7-
//
1+
// Endpoint
2+
// Created by Javier L. Avrudsky on 13/05/2020.
3+
// Copyright © 2020 Split. All rights reserved.
84

95
import Foundation
106

@@ -33,8 +29,7 @@ public class Endpoint {
3329

3430
if var queryString = defaultQueryString, let from = queryString.firstIndex(of: "&") {
3531
let upperLimit = queryString.index(from, offsetBy: 1)
36-
queryString = queryString.replacingOccurrences(of: "&", with: "",
37-
options: .caseInsensitive, range: from..<upperLimit)
32+
queryString = queryString.replacingOccurrences(of: "&", with: "", options: .caseInsensitive, range: from..<upperLimit)
3833
comp.query = queryString
3934
}
4035
self.url = comp.url ?? baseUrl
@@ -53,8 +48,7 @@ public class Endpoint {
5348
private var endpoint: Endpoint
5449

5550
public init(baseUrl: URL, path: String?, isPathEncoded: Bool, defaultQueryString: String? = nil) {
56-
endpoint = Endpoint(baseUrl: baseUrl, path: path,
57-
isPathEncoded: isPathEncoded, defaultQueryString: defaultQueryString)
51+
endpoint = Endpoint(baseUrl: baseUrl, path: path, isPathEncoded: isPathEncoded, defaultQueryString: defaultQueryString)
5852
}
5953

6054
public func add(header: String, withValue value: String) -> Self {

Sources/Http/HostDomainFilter.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
//
2-
// HostsFilter.swift
3-
// Http
4-
//
1+
// HostDomainFilter
52
// Created by Javier Avrudsky on 30/07/2024.
63
// Copyright © 2024 Split. All rights reserved.
7-
//
84

95
import Foundation
106

@@ -18,8 +14,7 @@ private extension String {
1814
public struct HostDomainFilter {
1915
public static let endString = "$"
2016
public static let mainRegex = "^(?:[a-zA-Z0-9_-]+\\.)"
21-
public static let wildCards = [(prefix: "**.", pattern: "\(mainRegex)*"),
22-
(prefix: "*.", pattern: "\(mainRegex)?")]
17+
public static let wildCards = [(prefix: "**.", pattern: "\(mainRegex)*"), (prefix: "*.", pattern: "\(mainRegex)?")]
2318

2419
public static func pinsFor(host: String, pins: [CredentialPin]) -> [CredentialPin] {
2520
var foundPins = [CredentialPin]()

Sources/Http/HttpAuthenticator.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// HttpAuthenticator
12
// Protocol for handling HTTPS authentication challenges.
3+
// Copyright © 2024 Split. All rights reserved.
24

35
import Foundation
46

5-
/// Implementations can provide custom certificate validation, client certificate authentication, or other challenge responses.
67
public protocol HttpAuthenticator: Sendable {
78
func authenticate(session: URLSession,
89
challenge: URLAuthenticationChallenge,

0 commit comments

Comments
 (0)