ui: Enable blocking queries by default (#6194)

-Enable blocking queries by default
-Change assertion to check for the last PUT request, not just any request for session destruction from a node page.

Since we've now turned on blocking queries by default this means that a
second GET request is made after the PUT request that we are asserting
for but before the assertion itself, this meant the assertion failed. We
double checked this by turning off blocking queries for this test using

```
And settings from yaml
---
consul:client:
  blocking: 0
---
```

which made the test pass again.

As moving forwards blocking queries will be on by default, we didn't
want to disable blocking queries for this test, so we now assert the
last PUT request specifically. This means we continue to assert that the
session has been destroyed but means we don't get into problems of
ordering of requests here
This commit is contained in:
John Cowen 2019-08-05 17:31:27 +02:00 committed by John Cowen
parent e636a72ffd
commit 5debc74fa2
5 changed files with 7 additions and 12 deletions

View File

@ -34,9 +34,6 @@ export default Controller.extend({
const blocking = get(this, 'item.client.blocking');
switch (target.name) {
case 'client[blocking]':
if (typeof blocking === 'undefined') {
set(this, 'item.client', {});
}
set(this, 'item.client.blocking', !blocking);
this.send('update', get(this, 'item'));
break;

View File

@ -1,7 +1,7 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { hash } from 'rsvp';
import { get } from '@ember/object';
import { get, set } from '@ember/object';
export default Route.extend({
client: service('client/http'),
@ -12,6 +12,9 @@ export default Route.extend({
item: get(this, 'repo').findAll(),
dcs: get(this, 'dcRepo').findAll(),
}).then(model => {
if (typeof get(model.item, 'client.blocking') === 'undefined') {
set(model, 'item.client', { blocking: true });
}
return hash({
...model,
...{

View File

@ -65,7 +65,7 @@ const createProxy = function(repo, find, settings, cache, serialize = JSON.strin
key: key,
type: BlockingEventSource,
settings: {
enabled: settings.blocking,
enabled: typeof settings.blocking === 'undefined' || settings.blocking,
},
createEvent: createEvent,
}

View File

@ -5,11 +5,6 @@ Feature: dc / list-blocking
I want to see changes if I change consul externally
Background:
Given 1 datacenter model with the value "dc-1"
And settings from yaml
---
consul:client:
blocking: 1
---
Scenario: Viewing the listing pages
Given 3 [Model] models
And a network latency of 100
@ -51,4 +46,4 @@ Feature: dc / list-blocking
-------------------------------------------------
| Page | Model | Url |
| service | instance | services/service-0 |
-------------------------------------------------
-------------------------------------------------

View File

@ -25,7 +25,7 @@ Feature: dc / nodes / sessions / invalidate: Invalidate Lock Sessions
Scenario: Invalidating the lock session
And I click delete on the sessions
And I click confirmDelete on the sessions
Then a PUT request is made to "/v1/session/destroy/7bbbd8bb-fff3-4292-b6e3-cfedd788546a?dc=dc1"
Then the last PUT request was made to "/v1/session/destroy/7bbbd8bb-fff3-4292-b6e3-cfedd788546a?dc=dc1"
Then the url should be /dc1/nodes/node-0
And "[data-notification]" has the "notification-delete" class
And "[data-notification]" has the "success" class