Skip to content

Commit

Permalink
ui: Enable blocking queries by default (#6194)
Browse files Browse the repository at this point in the history
-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
  • Loading branch information
johncowen authored and John Cowen committed Aug 29, 2019
1 parent 810ac53 commit cc1d848
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
3 changes: 0 additions & 3 deletions ui-v2/app/controllers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion ui-v2/app/routes/settings.js
Original file line number Diff line number Diff line change
@@ -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'),
Expand All @@ -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,
...{
Expand Down
2 changes: 1 addition & 1 deletion ui-v2/app/services/repository/type/event-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
7 changes: 1 addition & 6 deletions ui-v2/tests/acceptance/dc/list-blocking.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -51,4 +46,4 @@ Feature: dc / list-blocking
-------------------------------------------------
| Page | Model | Url |
| service | instance | services/service-0 |
-------------------------------------------------
-------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc1d848

Please sign in to comment.