Skip to content
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

fix: change STALE reason in case of context change #79

Merged
merged 1 commit into from
Feb 8, 2024
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
8 changes: 6 additions & 2 deletions Sources/ConfidenceProvider/ConfidenceFeatureProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,12 @@
)
return evaluationResult
} catch ConfidenceError.cachedValueExpired {
return ProviderEvaluation(value: defaultValue, variant: nil, reason: Reason.stale.rawValue)
} catch {
return ProviderEvaluation(value: defaultValue,

Check warning on line 254 in Sources/ConfidenceProvider/ConfidenceFeatureProvider.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Multiline Arguments Violation: Arguments should be either on the same line, or one per line (multiline_arguments)
variant: nil,

Check warning on line 255 in Sources/ConfidenceProvider/ConfidenceFeatureProvider.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Indentation Width Violation: Code should be indented using one tab or 4 spaces (indentation_width)

Check warning on line 255 in Sources/ConfidenceProvider/ConfidenceFeatureProvider.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
reason: Reason.error.rawValue,
errorCode: ErrorCode.providerNotReady
)}

Check warning on line 258 in Sources/ConfidenceProvider/ConfidenceFeatureProvider.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Statement Position Violation: Else and catch should be on the same line, one space after the previous declaration (statement_position)
catch {
throw error
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swiftlint:disable type_body_length

Check warning on line 1 in Tests/ConfidenceProviderTests/ConfidenceFeatureProviderTest.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Blanket Disable Command Violation: The disabled 'type_body_length' rule should be re-enabled before the end of the file (blanket_disable_command)
// swiftlint:disable file_length
import Foundation
import OpenFeature
Expand Down Expand Up @@ -347,10 +347,10 @@
context: MutableContext(targetingKey: "user1"))

XCTAssertEqual(evaluation.value, 0)
XCTAssertNil(evaluation.errorCode)
XCTAssertNil(evaluation.errorMessage)
XCTAssertNil(evaluation.variant)
XCTAssertEqual(evaluation.reason, Reason.stale.rawValue)
XCTAssertEqual(evaluation.errorCode, ErrorCode.providerNotReady)
XCTAssertEqual(evaluation.reason, Reason.error.rawValue)
XCTAssertEqual(MockedConfidenceClientURLProtocol.resolveStats, 1)

// TODO: Check this - how do we check for something not called?
Expand Down
Loading