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 some test failures that result from Realtime error changes #2006

Merged
merged 3 commits into from
Jan 9, 2025

Conversation

lawrence-forooghian
Copy link
Collaborator

@lawrence-forooghian lawrence-forooghian commented Jan 8, 2025

See commit messages for more details. Resolves #2008.

Summary by CodeRabbit

  • Tests
    • Updated test cases in multiple test files to use ARTErrorCode.invalidCredentials instead of ARTErrorCode.invalidCredential
    • Refined error code validation for connection and authentication scenarios
    • Improved consistency in error handling tests across different client components

Started failing recently, presumably as a result of some Realtime
change.
Started failing recently, presumably as a result of some Realtime
change. Have switched them to use the code that’s now being returned.
Not sure of the difference between these two codes; have asked in [1].

[1] https://ably-real-time.slack.com/archives/CURL4U2FP/p1736356509105489
Copy link

coderabbitai bot commented Jan 8, 2025

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 SwiftLint (0.57.0)
Test/Tests/AuthTests.swift

[
{
"character" : 1,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 2,
"reason" : "Imports should be unique",
"rule_id" : "duplicate_imports",
"severity" : "Warning",
"type" : "Duplicate Imports"
},
{
"character" : 35,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 1015,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 57,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 1235,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 61,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 1329,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 60,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 2380,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 72,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 2382,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 45,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 2383,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 35,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 2823,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 39,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3010,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 78,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3123,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 39,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3124,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 44,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3219,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 44,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3234,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 44,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3284,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 44,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3297,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 39,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3321,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 39,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3900,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 95,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3962,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 91,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 4046,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 4195,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 28,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 2381,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 35,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 2382,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 31,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 2387,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 19,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3953,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 24,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3962,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 19,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3963,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 15,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 4041,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 20,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 4046,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 15,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 4047,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 40,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 4461,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 21,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 98,
"reason" : "Prefer non-optional Data(_:) initializer when converting String to Data",
"rule_id" : "non_optional_string_data_conversion",
"severity" : "Warning",
"type" : "Non-optional String -> Data Conversion"
},
{
"character" : 10,
"file" : "/Test/Tests/AuthTests.swift",
"line" : 3944,
"reason" : "Type name 'TestCase_ReusableTestsTestTokenRequestFromJson' should only contain alphanumeric and other allowed characters",
"rule_id" : "type_name",
"severity" : "Error",
"type" : "Type Name"
}
]

Test/Tests/RealtimeClientConnectionTests.swift

[
{
"character" : 42,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 107,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 44,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 109,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 86,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 125,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 60,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 127,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 46,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 139,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 183,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 857,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 898,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 930,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 971,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 1029,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 1241,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 1280,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 1671,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 1716,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 1768,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 1933,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 119,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2011,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 52,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2177,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2582,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2604,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2615,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2644,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2658,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2684,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2698,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 53,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2731,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2751,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 54,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2905,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2953,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3175,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 66,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3320,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 58,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3669,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 58,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3700,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 24,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3729,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 66,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3769,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 66,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3780,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 66,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3811,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 44,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4402,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 61,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4437,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 61,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4449,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 53,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4459,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4472,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4506,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4553,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4570,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 59,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4617,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4670,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 45,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 5233,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 45,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 5313,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 45,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 5357,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 60,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 5362,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 39,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 102,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 11,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 103,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 27,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3381,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 27,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3441,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 31,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3532,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 36,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 5247,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 57,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 5282,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 36,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 5333,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 57,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 5389,
"reason" : "Force tries should be avoided",
"rule_id" : "force_try",
"severity" : "Error",
"type" : "Force Try"
},
{
"character" : 73,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 2292,
"reason" : "Initializing an optional variable with nil is redundant",
"rule_id" : "redundant_optional_initialization",
"severity" : "Warning",
"type" : "Redundant Optional Initialization"
},
{
"character" : 55,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3087,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3346,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3414,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3466,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 48,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3470,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 47,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3474,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3489,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3493,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3508,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 47,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3512,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3554,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3604,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 58,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3678,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 57,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3709,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 60,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3735,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 64,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 3738,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4551,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4615,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 50,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4850,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
},
{
"character" : 51,
"file" : "/Test/Tests/RealtimeClientConnectionTests.swift",
"line" : 4879,
"reason" : "Unused parameter in a closure should be replaced with _",
"rule_id" : "unused_closure_parameter",
"severity" : "Warning",
"type" : "Unused Closure Parameter"
}
]

Test/Tests/RestClientTests.swift

[
{
"character" : 53,
"file" : "/Test/Tests/RestClientTests.swift",
"line" : 1656,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 70,
"file" : "/Test/Tests/RestClientTests.swift",
"line" : 1658,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 48,
"file" : "/Test/Tests/RestClientTests.swift",
"line" : 1659,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
},
{
"character" : 53,
"file" : "/Test/Tests/RestClientTests.swift",
"line" : 1694,
"reason" : "Force casts should be avoided",
"rule_id" : "force_cast",
"severity" : "Error",
"type" : "Force Cast"
}
]

Walkthrough

The pull request focuses on updating error code references in test files related to authentication and connection failures. The changes primarily involve replacing ARTErrorCode.invalidCredential with ARTErrorCode.invalidCredentials across multiple test files including AuthTests.swift, RealtimeClientConnectionTests.swift, and RestClientTests.swift. These modifications aim to standardize error code handling and ensure consistent error validation across different test scenarios involving authentication and connection attempts.

Changes

File Change Summary
Test/Tests/AuthTests.swift Modified error validation to check errorInfo.code against ARTErrorCode.invalidCredentials
Test/Tests/RealtimeClientConnectionTests.swift Updated error code assertion to accept both invalidCredential and invalidCredentials error codes
Test/Tests/RestClientTests.swift Updated error code references from invalidCredential to invalidCredentials in test methods

Assessment against linked issues

Objective Addressed Explanation
Fix test failures related to authentication errors [#2008]
Handle varying error codes between production and frontend environments

Possibly related PRs

  • No strongly related PRs identified in the provided context.

Poem

🐰 Errors dance, codes entwine,
From invalidCredential to a new design,
Tests hop and skip with newfound grace,
Credentials validated, each in its place!
A rabbit's code, both smart and fine! 🔑

Finishing Touches

  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot temporarily deployed to staging/pull/2006/features January 8, 2025 17:25 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/2006/jazzydoc January 8, 2025 17:27 Inactive
I considered switching the test to instead use sandbox, but discovered
that fallback hosts for realtime connections with custom environments
are not working; see #2009.

Resolves #2008.
@lawrence-forooghian lawrence-forooghian marked this pull request as ready for review January 9, 2025 19:18
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
Test/Tests/RealtimeClientConnectionTests.swift (1)

4135-4136: LGTM! The comment explains the dual error code handling well.

The comment provides valuable context about why both invalidCredential and invalidCredentials error codes need to be handled due to the production environment using both frontend and frontdoor systems.

Consider adding a period at the end of the comment for consistency:

- // This is because, at time of writing, the production environment is handling connections using both frontend (which returns invalidCredential) and frontdoor (which returns invalidCredentials). So we need to handle both cases at least for now (unlike other tests, which use sandbox which is 100% using frontdoor)
+ // This is because, at time of writing, the production environment is handling connections using both frontend (which returns invalidCredential) and frontdoor (which returns invalidCredentials). So we need to handle both cases at least for now (unlike other tests, which use sandbox which is 100% using frontdoor).
Test/Tests/RestClientTests.swift (1)

196-196: Standardize error code validation for authentication failures

The changes update the error code validation to use ARTErrorCode.invalidCredentials consistently across authentication failure test cases.

Consider adding a test helper function to encapsulate common error code validation logic, as this pattern appears in multiple test cases.

Also applies to: 237-237

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aca9a7c and 0a3caf4.

📒 Files selected for processing (3)
  • Test/Tests/AuthTests.swift (1 hunks)
  • Test/Tests/RealtimeClientConnectionTests.swift (1 hunks)
  • Test/Tests/RestClientTests.swift (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: check (tvOS, test_tvOS17_2)
🔇 Additional comments (1)
Test/Tests/AuthTests.swift (1)

415-415: LGTM! Good improvement to error validation.

Switching from error message string validation to error code validation makes the test more robust and reliable, as error messages can change but error codes are more stable.

@lawrence-forooghian lawrence-forooghian merged commit 23485fa into main Jan 9, 2025
8 checks passed
@lawrence-forooghian lawrence-forooghian deleted the 2025-08-01-fix-tests branch January 9, 2025 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Fix new test failures
2 participants