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

Raft Snapshot Restore Bug #13107

Merged
merged 2 commits into from
Nov 17, 2021
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
3 changes: 3 additions & 0 deletions changelog/13107.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Fixes issue restoring raft storage snapshot
```
1 change: 1 addition & 0 deletions ui/app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { assign } from '@ember/polyfills';
import { set } from '@ember/object';
import RSVP from 'rsvp';
import config from '../config/environment';
import fetch from 'fetch';

const { APP } = config;
const { POLLING_URLS, NAMESPACE_ROOT_URLS } = APP;
Expand Down
31 changes: 31 additions & 0 deletions ui/tests/integration/components/raft-storage-restore-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { render, triggerEvent, click } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | raft-storage-restore', function(hooks) {
setupRenderingTest(hooks);
setupMirage(hooks);

test('it should restore snapshot', async function(assert) {
assert.expect(2);

this.server.post('/sys/storage/raft/snapshot', () => {
assert.ok(true, 'Request made to restore snapshot');
return;
});
this.server.post('/sys/storage/raft/snapshot-force', () => {
assert.ok(true, 'Request made to force restore snapshot');
return;
});

await render(hbs`<RaftStorageRestore />`);
await triggerEvent('[data-test-file-input]', 'change', {
files: [new Blob(['Raft Snapshot'])],
});
await click('[data-test-edit-form-submit]');
await click('#force-restore');
await click('[data-test-edit-form-submit]');
});
});