Commits

Yury Bondarenko authored c844423fc33
94485: Fix initialization deadlock when backend is unavailable

When the REST server can't be found, `getEndpoint` errors out, no request gets sent, which causes `fetchRequest` to never emit. Because of this the `checkTokenCookie$` effect would get deadlocked and initialization would never complete.
No tags

src/app/core/auth/auth-request.service.spec.ts

Modified
104 104 service.getRequest('method', options);
105 105 flush();
106 106
107 107 expect(requestService.send).toHaveBeenCalledWith(objectContaining({
108 108 uuid: requestID,
109 109 href: endpointURL + '/method',
110 110 method: RestRequestMethod.GET,
111 111 body: undefined,
112 112 options,
113 113 }));
114 - expect((service as any).fetchRequest).toHaveBeenCalledWith(requestID);
115 114 });
116 115 });
117 116 });
118 117
119 118 describe('POST', () => {
120 119 it('should send a POST request to the right endpoint and return the auth status', () => {
121 120 testScheduler.run(({ cold, expectObservable, flush }) => {
122 121 init(cold);
123 122
124 123 expectObservable(service.postToEndpoint('method', { content: 'something' }, options)).toBe('a', {
144 143 service.postToEndpoint('method', { content: 'something' }, options);
145 144 flush();
146 145
147 146 expect(requestService.send).toHaveBeenCalledWith(objectContaining({
148 147 uuid: requestID,
149 148 href: endpointURL + '/method',
150 149 method: RestRequestMethod.POST,
151 150 body: { content: 'something' },
152 151 options,
153 152 }));
154 - expect((service as any).fetchRequest).toHaveBeenCalledWith(requestID);
155 153 });
156 154 });
157 155 });
158 156 });
159 157
160 158 describe(`getShortlivedToken`, () => {
161 159 it(`should call createShortLivedTokenRequest with the url for the endpoint`, () => {
162 160 testScheduler.run(({ cold, expectObservable, flush }) => {
163 161 init(cold);
164 162 spyOn(service as any, 'createShortLivedTokenRequest');

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut