Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-2095

Add back missing test for 4003 "moved permanently" websocket response from server

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sync
    • None

      The latest updates to App and the app tests in Core master has removed the old testing for both a HTTP 308 and websocket 4003 error responses and only tests the HTTP 308 response. Update this test to include both types of return values from the server.

      Original test: https://github.com/realm/realm-core/blob/4d815c6e6883bfdcb67cf755d0f0f29a4b399ea7/test/object-store/sync/app.cpp#L2988-L2996

          redir_provider->websocket_connect_func = [&logger, &connect_count]() -> std::optional<SocketProviderError> {
              logger->trace("websocket connect (%1)", ++connect_count);
              if (connect_count == 1)
                  return SocketProviderError(sync::HTTPStatus::PermanentRedirect);
              if (connect_count == 2)
                  return SocketProviderError(sync::websocket::WebSocketError::websocket_moved_permanently);
              return std::nullopt;
          };
      

      Updated test: https://github.com/realm/realm-core/blob/master/test/object-store/sync/app.cpp#L3462-L3470

          socket_provider->websocket_connect_func = [&]() -> std::optional<SocketProviderError> {
              // Report a 308 response the first time we try to reconnect the websocket,
              // which should result in App performing a location update.
              // The actual Location header isn't used when we get a redirect on
              // the websocket, so we don't need to supply it here
              if (connect_count++ > 0)
                  return std::nullopt;
              return sync::HTTPStatus::PermanentRedirect;
          };
      

            Assignee:
            jonathan.reams@mongodb.com Jonathan Reams
            Reporter:
            michael.wilkersonbarker@mongodb.com Michael Wilkerson-Barker (Inactive)
            AD Sync Client
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: