Skip to content

Commit

Permalink
Tests and routes move csi/ to storage/
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Feb 25, 2025
1 parent 303d759 commit 9a14b26
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 52 deletions.
2 changes: 1 addition & 1 deletion ui/app/controllers/storage/plugins/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import Controller from '@ember/controller';

export default class CsiPluginsPluginController extends Controller {
export default class StoragePluginsPluginController extends Controller {
get plugin() {
return this.model;
}
Expand Down
5 changes: 5 additions & 0 deletions ui/app/routes/administration/policies/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ operator {
# * alloc-lifecycle
# * csi-write-volume
# * csi-mount-volume
# * host-volume-create
# * host-volume-register
# * host-volume-read
# * host-volume-write
# * host-volume-delete
# * list-scaling-policies
# * read-scaling-policy
# * read-job-scaling
Expand Down
2 changes: 1 addition & 1 deletion ui/app/routes/storage/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class IndexRoute extends Route.extend(WithWatchers) {
@service store;

startWatchers(controller) {
controller.set('modelWatch', this.watch.perform({ type: 'csi' }));
controller.set('modelWatch', this.watch.perform({ type: 'host' }));
}

@watchQuery('plugin') watch;
Expand Down
2 changes: 1 addition & 1 deletion ui/app/services/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export default class KeyboardService extends Service {

// If no activeLink, means we're nested within a primary section.
// Luckily, Ember's RouteInfo.find() gives us access to parents and connected leaves of a route.
// So, if we're on /csi/volumes but the nav link is to /csi, we'll .find() it.
// So, if we're on /storage/volumes but the nav link is to /storage, we'll .find() it.
// Similarly, /job/:job/taskgroupid/index will find /job.
if (!activeLink) {
activeLink = links.find((link) => {
Expand Down
3 changes: 2 additions & 1 deletion ui/app/templates/storage/volumes/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SPDX-License-Identifier: BUSL-1.1
~}}

{{page-title "CSI Volumes"}}
{{page-title "Volumes"}}
<StorageSubnav />
<section class="section">
<div class="toolbar">
Expand Down Expand Up @@ -166,6 +166,7 @@
</h3>
<p class="empty-message-body">
This namespace currently has no CSI Volumes.
{{!-- TODO: make sure the empty-message is generalized to include DHV --}}
</p>
{{else if this.searchTerm}}
<h3 data-test-empty-volumes-list-headline class="empty-message-headline">
Expand Down
5 changes: 3 additions & 2 deletions ui/app/templates/storage/volumes/volume.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Breadcrumb @crumb={{crumb}} />
{{/each}}
{{page-title "CSI Volume " this.model.name}}
{{!-- TODO: determine if /volumes/volume will just be CSI or if we ought to generalize it --}}
<section class="section with-headspace">
<h1 class="title" data-test-title>{{this.model.name}}</h1>

Expand Down Expand Up @@ -57,7 +58,7 @@
</t.head>
<t.body as |row|>
<AllocationRow
{{keyboard-shortcut
{{keyboard-shortcut
enumerated=true
action=(action "gotoAllocation" row.model)
}}
Expand Down Expand Up @@ -99,7 +100,7 @@
</t.head>
<t.body as |row|>
<AllocationRow
{{keyboard-shortcut
{{keyboard-shortcut
enumerated=true
action=(action "gotoAllocation" row.model)
}}
Expand Down
4 changes: 2 additions & 2 deletions ui/tests/acceptance/plugin-allocations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module('Acceptance | plugin allocations', function (hooks) {
await a11yAudit(assert);
});

test('/csi/plugins/:id/allocations shows all allocations in a single table', async function (assert) {
test('/storage/plugins/:id/allocations shows all allocations in a single table', async function (assert) {
plugin = server.create('csi-plugin', {
shallow: true,
controllerRequired: true,
Expand Down Expand Up @@ -172,7 +172,7 @@ module('Acceptance | plugin allocations', function (hooks) {

assert.equal(
currentURL(),
`/csi/plugins/${plugin.id}/allocations?${queryString}`
`/storage/plugins/${plugin.id}/allocations?${queryString}`
);
});
}
Expand Down
25 changes: 15 additions & 10 deletions ui/tests/acceptance/plugin-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,25 @@ module('Acceptance | plugin detail', function (hooks) {
await a11yAudit(assert);
});

test('/csi/plugins/:id should have a breadcrumb trail linking back to Plugins and Storage', async function (assert) {
test('/storage/plugins/:id should have a breadcrumb trail linking back to Plugins and Storage', async function (assert) {
await PluginDetail.visit({ id: plugin.id });

assert.equal(Layout.breadcrumbFor('csi.index').text, 'Storage');
assert.equal(Layout.breadcrumbFor('csi.plugins').text, 'Plugins');
assert.equal(Layout.breadcrumbFor('csi.plugins.plugin').text, plugin.id);
assert.equal(Layout.breadcrumbFor('storage.index').text, 'Storage');
assert.equal(Layout.breadcrumbFor('storage.plugins').text, 'Plugins');
assert.equal(
Layout.breadcrumbFor('storage.plugins.plugin').text,
plugin.id
);
});

test('/csi/plugins/:id should show the plugin name in the title', async function (assert) {
test('/storage/plugins/:id should show the plugin name in the title', async function (assert) {
await PluginDetail.visit({ id: plugin.id });

assert.equal(document.title, `CSI Plugin ${plugin.id} - Nomad`);
assert.equal(PluginDetail.title, plugin.id);
});

test('/csi/plugins/:id should list additional details for the plugin below the title', async function (assert) {
test('/storage/plugins/:id should list additional details for the plugin below the title', async function (assert) {
await PluginDetail.visit({ id: plugin.id });

assert.ok(
Expand Down Expand Up @@ -74,7 +77,7 @@ module('Acceptance | plugin detail', function (hooks) {
assert.ok(PluginDetail.provider.includes(plugin.provider));
});

test('/csi/plugins/:id should list all the controller plugin allocations for the plugin', async function (assert) {
test('/storage/plugins/:id should list all the controller plugin allocations for the plugin', async function (assert) {
await PluginDetail.visit({ id: plugin.id });

assert.equal(
Expand All @@ -92,7 +95,7 @@ module('Acceptance | plugin detail', function (hooks) {
});
});

test('/csi/plugins/:id should list all the node plugin allocations for the plugin', async function (assert) {
test('/storage/plugins/:id should list all the node plugin allocations for the plugin', async function (assert) {
await PluginDetail.visit({ id: plugin.id });

assert.equal(PluginDetail.nodeAllocations.length, plugin.nodes.length);
Expand Down Expand Up @@ -267,7 +270,9 @@ module('Acceptance | plugin detail', function (hooks) {
await PluginDetail.goToControllerAllocations();
assert.equal(
currentURL(),
`/csi/plugins/${plugin.id}/allocations?type=${serialize(['controller'])}`
`/storage/plugins/${plugin.id}/allocations?type=${serialize([
'controller',
])}`
);

await PluginDetail.visit({ id: plugin.id });
Expand All @@ -277,7 +282,7 @@ module('Acceptance | plugin detail', function (hooks) {
await PluginDetail.goToNodeAllocations();
assert.equal(
currentURL(),
`/csi/plugins/${plugin.id}/allocations?type=${serialize(['node'])}`
`/storage/plugins/${plugin.id}/allocations?type=${serialize(['node'])}`
);
});
});
16 changes: 8 additions & 8 deletions ui/tests/acceptance/plugins-list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ module('Acceptance | plugins list', function (hooks) {
await a11yAudit(assert);
});

test('visiting /csi/plugins', async function (assert) {
test('visiting /storage/plugins', async function (assert) {
await PluginsList.visit();

assert.equal(currentURL(), '/csi/plugins');
assert.equal(currentURL(), '/storage/plugins');
assert.equal(document.title, 'CSI Plugins - Nomad');
});

test('/csi/plugins should list the first page of plugins sorted by id', async function (assert) {
test('/storage/plugins should list the first page of plugins sorted by id', async function (assert) {
const pluginCount = PluginsList.pageSize + 1;
server.createList('csi-plugin', pluginCount, { shallow: true });

Expand Down Expand Up @@ -98,13 +98,13 @@ module('Acceptance | plugins list', function (hooks) {
await PluginsList.visit();

await PluginsList.plugins.objectAt(0).clickName();
assert.equal(currentURL(), `/csi/plugins/${plugin.id}`);
assert.equal(currentURL(), `/storage/plugins/${plugin.id}`);

await PluginsList.visit();
assert.equal(currentURL(), '/csi/plugins');
assert.equal(currentURL(), '/storage/plugins');

await PluginsList.plugins.objectAt(0).clickRow();
assert.equal(currentURL(), `/csi/plugins/${plugin.id}`);
assert.equal(currentURL(), `/storage/plugins/${plugin.id}`);
});

test('when there are no plugins, there is an empty message', async function (assert) {
Expand Down Expand Up @@ -133,11 +133,11 @@ module('Acceptance | plugins list', function (hooks) {
await PluginsList.visit();
await PluginsList.nextPage();

assert.equal(currentURL(), '/csi/plugins?page=2');
assert.equal(currentURL(), '/storage/plugins?page=2');

await PluginsList.search('foobar');

assert.equal(currentURL(), '/csi/plugins?search=foobar');
assert.equal(currentURL(), '/storage/plugins?search=foobar');
});

test('when accessing plugins is forbidden, a message is shown with a link to the tokens page', async function (assert) {
Expand Down
2 changes: 1 addition & 1 deletion ui/tests/acceptance/search-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ module('Acceptance | search', function (hooks) {

await selectSearch(Layout.navbar.search.scope, 'xy');
await Layout.navbar.search.groups[4].options[0].click();
assert.equal(currentURL(), '/csi/plugins/xyz-plugin');
assert.equal(currentURL(), '/storage/plugins/xyz-plugin');

const fuzzySearchQueries = server.pretender.handledRequests.filterBy(
'url',
Expand Down
21 changes: 12 additions & 9 deletions ui/tests/acceptance/volume-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,25 @@ module('Acceptance | volume detail', function (hooks) {
await a11yAudit(assert);
});

test('/csi/volumes/:id should have a breadcrumb trail linking back to Volumes and Storage', async function (assert) {
test('/storage/volumes/:id should have a breadcrumb trail linking back to Volumes and Storage', async function (assert) {
await VolumeDetail.visit({ id: `${volume.id}@default` });

assert.equal(Layout.breadcrumbFor('csi.index').text, 'Storage');
assert.equal(Layout.breadcrumbFor('csi.volumes').text, 'Volumes');
assert.equal(Layout.breadcrumbFor('csi.volumes.volume').text, volume.name);
assert.equal(Layout.breadcrumbFor('storage.index').text, 'Storage');
assert.equal(Layout.breadcrumbFor('storage.volumes').text, 'Volumes');
assert.equal(
Layout.breadcrumbFor('storage.volumes.volume').text,
volume.name
);
});

test('/csi/volumes/:id should show the volume name in the title', async function (assert) {
test('/storage/volumes/:id should show the volume name in the title', async function (assert) {
await VolumeDetail.visit({ id: `${volume.id}@default` });

assert.equal(document.title, `CSI Volume ${volume.name} - Nomad`);
assert.equal(VolumeDetail.title, volume.name);
});

test('/csi/volumes/:id should list additional details for the volume below the title', async function (assert) {
test('/storage/volumes/:id should list additional details for the volume below the title', async function (assert) {
await VolumeDetail.visit({ id: `${volume.id}@default` });

assert.ok(
Expand All @@ -75,7 +78,7 @@ module('Acceptance | volume detail', function (hooks) {
);
});

test('/csi/volumes/:id should list all write allocations the volume is attached to', async function (assert) {
test('/storage/volumes/:id should list all write allocations the volume is attached to', async function (assert) {
const writeAllocations = server.createList('allocation', 2);
const readAllocations = server.createList('allocation', 3);
writeAllocations.forEach((alloc) => assignWriteAlloc(volume, alloc));
Expand All @@ -95,7 +98,7 @@ module('Acceptance | volume detail', function (hooks) {
});
});

test('/csi/volumes/:id should list all read allocations the volume is attached to', async function (assert) {
test('/storage/volumes/:id should list all read allocations the volume is attached to', async function (assert) {
const writeAllocations = server.createList('allocation', 2);
const readAllocations = server.createList('allocation', 3);
writeAllocations.forEach((alloc) => assignWriteAlloc(volume, alloc));
Expand Down Expand Up @@ -250,7 +253,7 @@ module('Acceptance | volume detail (with namespaces)', function (hooks) {
volume = server.create('csi-volume');
});

test('/csi/volumes/:id detail ribbon includes the namespace of the volume', async function (assert) {
test('/storage/volumes/:id detail ribbon includes the namespace of the volume', async function (assert) {
await VolumeDetail.visit({ id: `${volume.id}@${volume.namespaceId}` });

assert.ok(VolumeDetail.hasNamespace);
Expand Down
28 changes: 17 additions & 11 deletions ui/tests/acceptance/volumes-list-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,26 @@ module('Acceptance | volumes list', function (hooks) {
await a11yAudit(assert);
});

test('visiting /csi redirects to /csi/volumes', async function (assert) {
test('visiting /storage redirects to /storage/volumes', async function (assert) {
await visit('/storage');

assert.equal(currentURL(), '/storage/volumes');
});

test('visiting the now-deprecated /csi redirects to /storage/volumes', async function (assert) {
await visit('/csi');

assert.equal(currentURL(), '/csi/volumes');
assert.equal(currentURL(), '/storage/volumes');
});

test('visiting /csi/volumes', async function (assert) {
test('visiting /storage/volumes', async function (assert) {
await VolumesList.visit();

assert.equal(currentURL(), '/csi/volumes');
assert.equal(document.title, 'CSI Volumes - Nomad');
assert.equal(currentURL(), '/storage/volumes');
assert.equal(document.title, 'Volumes - Nomad');
});

test('/csi/volumes should list the first page of volumes sorted by name', async function (assert) {
test('/storage/volumes should list the first page of volumes sorted by name', async function (assert) {
const volumeCount = VolumesList.pageSize + 1;
server.createList('csi-volume', volumeCount);

Expand Down Expand Up @@ -120,16 +126,16 @@ module('Acceptance | volumes list', function (hooks) {
await VolumesList.volumes.objectAt(0).clickName();
assert.equal(
currentURL(),
`/csi/volumes/${volume.id}@${secondNamespace.id}`
`/storage/volumes/${volume.id}@${secondNamespace.id}`
);

await VolumesList.visit({ namespace: '*' });
assert.equal(currentURL(), '/csi/volumes?namespace=*');
assert.equal(currentURL(), '/storage/volumes?namespace=*');

await VolumesList.volumes.objectAt(0).clickRow();
assert.equal(
currentURL(),
`/csi/volumes/${volume.id}@${secondNamespace.id}`
`/storage/volumes/${volume.id}@${secondNamespace.id}`
);
});

Expand Down Expand Up @@ -159,11 +165,11 @@ module('Acceptance | volumes list', function (hooks) {
await VolumesList.visit();
await VolumesList.nextPage();

assert.equal(currentURL(), '/csi/volumes?page=2');
assert.equal(currentURL(), '/storage/volumes?page=2');

await VolumesList.search('foobar');

assert.equal(currentURL(), '/csi/volumes?search=foobar');
assert.equal(currentURL(), '/storage/volumes?search=foobar');
});

test('when the cluster has namespaces, each volume row includes the volume namespace', async function (assert) {
Expand Down
2 changes: 1 addition & 1 deletion ui/tests/pages/storage/plugins/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import allocations from 'nomad-ui/tests/pages/components/allocations';

export default create({
visit: visitable('/csi/plugins/:id'),
visit: visitable('/storage/plugins/:id'),

title: text('[data-test-title]'),

Expand Down
2 changes: 1 addition & 1 deletion ui/tests/pages/storage/plugins/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import pageSizeSelect from 'nomad-ui/tests/pages/components/page-size-select';
export default create({
pageSize: 25,

visit: visitable('/csi/plugins'),
visit: visitable('/storage/plugins'),

search: fillable('[data-test-plugins-search] input'),

Expand Down
2 changes: 1 addition & 1 deletion ui/tests/pages/storage/plugins/plugin/allocations.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import pageSizeSelect from 'nomad-ui/tests/pages/components/page-size-select';
export default create({
pageSize: 25,

visit: visitable('/csi/plugins/:id/allocations'),
visit: visitable('/storage/plugins/:id/allocations'),

nextPage: clickable('[data-test-pager="next"]'),
prevPage: clickable('[data-test-pager="prev"]'),
Expand Down
2 changes: 1 addition & 1 deletion ui/tests/pages/storage/volumes/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { create, isPresent, text, visitable } from 'ember-cli-page-object';
import allocations from 'nomad-ui/tests/pages/components/allocations';

export default create({
visit: visitable('/csi/volumes/:id'),
visit: visitable('/storage/volumes/:id'),

title: text('[data-test-title]'),

Expand Down
2 changes: 1 addition & 1 deletion ui/tests/pages/storage/volumes/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import pageSizeSelect from 'nomad-ui/tests/pages/components/page-size-select';
export default create({
pageSize: 25,

visit: visitable('/csi/volumes'),
visit: visitable('/storage/volumes'),

search: fillable('[data-test-volumes-search] input'),

Expand Down

0 comments on commit 9a14b26

Please sign in to comment.