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 for "test__090__RestClient__request_…" #1839

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

maratal
Copy link
Collaborator

@maratal maratal commented Nov 18, 2023

Partially addresses #1796

In a test suite this failure goes as test__092__RestClient__request__method_signature_and_arguments__should_do_a_request_and_receive_a_valid_response, i.e. the test which is being executed at the moment when fail("Completion closure should not be called") is called within test__090__RestClient__... test.

Test passes frequently on CI because I assume tests failures after execution not always tracked by XCTest framework. Locally it crashes with this:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempted to report a test failure to XCTest while no test case was running. The failure was:
"Completion closure should not be called".

The path "new feature" is not an invalid path, since it's being replaced with "new%20feature" in Foundation. Also this check has nothing to do with a whitespace in the middle. So I'm removing this expectation.

I've noticed that this test fails frequently when other well known set of tests don't fail. So when I've fixed it in this experimental PR, iOS 17 job finally could pass (after a few attemts).

…_method_signature_and_arguments__should_do_a_request_and_receive_a_valid_response", i.e. the test which is being executed at the moment when fail("Completion closure should not be called") is called within "test__090__RestClient__..." test (https://github.com/ably/ably-cocoa/blob/ca4ffa1f582714945b9f323a1dc86b1da57c974f/Test/Tests/RestClientTests.swift#L1916).

Test passes frequently on CI because I assume tests failures after execution not always tracked by XCTest framework. Locally it crashes with this:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempted to report a test failure to XCTest while no test case was running. The failure was:
"Completion closure should not be called".

The path "new feature" is not an invalid path, since it's being replaced with "new%20feature" in Foundation. So I'm removing this check.

I've noticed that this test fails frequently when other well known set of tests (https://test-observability.herokuapp.com/repos/ably/ably-cocoa/uploads/554d09f1-71e2-4e79-b641-9f33a8382220) don't fail. So when I've fixed it in this experimental PR (#1799), it finally could pass (after a few attemts).
@github-actions github-actions bot temporarily deployed to staging/pull/1839/features November 18, 2023 22:10 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1839/jazzydoc November 18, 2023 22:16 Inactive
@lawrence-forooghian
Copy link
Collaborator

The path "new feature" is not an invalid path, since it's being replaced with "new%20feature" in Foundation.

This is due to the behaviour change in iOS 17 explained here:

For apps linked on or after iOS 17 and aligned OS versions, NSURL parsing has updated from the obsolete RFC 1738/1808 parsing to the same RFC 3986 parsing as NSURLComponents. This unifies the parsing behaviors of the NSURL and NSURLComponents APIs. Now, NSURL automatically percent- and IDNA-encodes invalid characters to help create a valid URL.

Copy link
Collaborator

@lawrence-forooghian lawrence-forooghian left a comment

Choose a reason for hiding this comment

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

I suggest adding a comment here to explain that this error is not possible on iOS 17 and above due to the behaviour I explained above, so that people who see this code understand why we don't have a test for it.

…t__method_signature_and_arguments__should_error_if_path_is_invalid" (see commit 76fb658).
@maratal maratal merged commit dee121a into main Dec 14, 2023
7 checks passed
@maratal maratal deleted the fix/1796-test__090__RestClient-fix branch December 14, 2023 22:11
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.

2 participants