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

ui: Ensure blocking query configuration is passed through to findInstanceBySlug #7543

Merged
merged 2 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui-v2/app/services/repository/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export default RepositoryService.extend({
return service;
});
},
findInstanceBySlug: function(id, node, slug, dc, configuration) {
return this.findBySlug(slug, dc, configuration).then(function(item) {
findInstanceBySlug: function(id, node, slug, dc, nspace, configuration) {
return this.findBySlug(slug, dc, nspace, configuration).then(function(item) {
// TODO: Move this to the Serializer
// Loop through all the service instances and pick out the one
// that has the same service id AND node name
Expand Down
28 changes: 28 additions & 0 deletions ui-v2/tests/integration/services/repository/service-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,34 @@ const id = 'token-name';
const now = new Date().getTime();
const undefinedNspace = 'default';
[undefinedNspace, 'team-1', undefined].forEach(nspace => {
test(`findInstanceBySlug calls findBySlug with the correct arguments when nspace is ${nspace}`, function(assert) {
assert.expect(4);
const id = 'id';
const slug = 'slug';
const node = 'node-name';

const datacenter = 'dc-1';
const conf = {
cursor: 1,
};
const service = this.subject();
service.findBySlug = function(slug, dc, nspace, configuration) {
assert.equal(
arguments.length,
4,
'Expected to be called with the correct number of arguments'
);
assert.equal(dc, datacenter);
assert.deepEqual(configuration, conf);
return Promise.resolve({ Nodes: [] });
};
// This will throw an error as we don't resolve any services that match what was requested
// so a 404 is the correct error response
return service.findInstanceBySlug(id, slug, node, datacenter, nspace, conf).catch(function(e) {
assert.equal(e.errors[0].status, '404');
});
});

test(`findByDatacenter returns the correct data for list endpoint when nspace is ${nspace}`, function(assert) {
get(this.subject(), 'store').serializerFor(NAME).timestamp = function() {
return now;
Expand Down