foreman_snapshot_management 1.6.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -2
- data/Rakefile +7 -2
- data/app/controllers/api/v2/snapshots_controller.rb +37 -7
- data/app/controllers/concerns/foreman/controller/parameters/snapshot.rb +1 -1
- data/app/controllers/foreman_snapshot_management/snapshots_controller.rb +5 -5
- data/app/models/concerns/fog_extensions/proxmox/snapshots/mock.rb +24 -0
- data/app/models/foreman_snapshot_management/proxmox_extensions.rb +101 -0
- data/app/models/foreman_snapshot_management/snapshot.rb +28 -28
- data/app/models/foreman_snapshot_management/vmware_extensions.rb +40 -13
- data/app/views/api/v2/snapshots/base.json.rabl +2 -0
- data/app/views/api/v2/snapshots/main.json.rabl +2 -2
- data/app/views/foreman_snapshot_management/snapshots/_index.html.erb +12 -74
- data/app/views/hosts/_snapshots_tab.html.erb +8 -0
- data/lib/foreman_snapshot_management/engine.rb +35 -16
- data/lib/foreman_snapshot_management/version.rb +1 -1
- data/lib/tasks/foreman_snapshot_management_tasks.rake +2 -2
- data/locale/de/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
- data/locale/de/foreman_snapshot_management.po +195 -0
- data/locale/en/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
- data/locale/en/foreman_snapshot_management.po +179 -11
- data/locale/foreman_snapshot_management.pot +259 -8
- data/locale/gemspec.rb +1 -1
- data/package.json +46 -0
- data/test/controllers/api/v2/snapshots_test.rb +250 -39
- data/test/controllers/foreman_snapshot_management/snapshots_controller_test.rb +61 -9
- data/test/factories/proxmox_factory.rb +18 -0
- data/test/test_plugin_helper.rb +3 -0
- data/webpack/components/SnapshotManagement/SnapshotManagement.js +84 -0
- data/webpack/components/SnapshotManagement/SnapshotManagementActions.js +212 -0
- data/webpack/components/SnapshotManagement/SnapshotManagementConstants.js +9 -0
- data/webpack/components/SnapshotManagement/SnapshotManagementReducer.js +100 -0
- data/webpack/components/SnapshotManagement/SnapshotManagementSelectors.js +8 -0
- data/webpack/components/SnapshotManagement/__tests__/SnapshotManagementActions.test.js +123 -0
- data/webpack/components/SnapshotManagement/__tests__/SnapshotManagementReducer.test.js +157 -0
- data/webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementActions.test.js.snap +314 -0
- data/webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementReducer.test.js.snap +214 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotForm.js +118 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotFormConstants.js +5 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/SnapshotForm.test.js +26 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/__snapshots__/SnapshotForm.test.js.snap +476 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/index.js +19 -0
- data/webpack/components/SnapshotManagement/components/SnapshotForm/snapshotForm.scss +3 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModal.js +37 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModalConstants.js +1 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/SnapshotFormModal.test.js +19 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/__snapshots__/SnapshotFormModal.test.js.snap +19 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/index.js +12 -0
- data/webpack/components/SnapshotManagement/components/SnapshotFormModal/useSnapshotFormModal.js +7 -0
- data/webpack/components/SnapshotManagement/components/SnapshotList/SnapshotList.js +314 -0
- data/webpack/components/SnapshotManagement/components/SnapshotList/SnapshotListHelper.js +70 -0
- data/webpack/components/SnapshotManagement/components/SnapshotList/__tests__/SnapshotList.test.js +88 -0
- data/webpack/components/SnapshotManagement/components/SnapshotList/__tests__/__snapshots__/SnapshotList.test.js.snap +1081 -0
- data/webpack/components/SnapshotManagement/components/SnapshotList/snapshotList.scss +13 -0
- data/webpack/components/SnapshotManagement/index.js +33 -0
- data/webpack/components/SnapshotManagement/snapshotManagement.scss +5 -0
- data/webpack/global_index.js +7 -0
- data/webpack/global_test_setup.js +11 -0
- data/webpack/index.js +8 -0
- data/webpack/reducers.js +7 -0
- data/webpack/test_setup.js +17 -0
- metadata +50 -37
@@ -0,0 +1,9 @@
|
|
1
|
+
export const SNAPSHOT_LIST = 'FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_LIST';
|
2
|
+
export const SNAPSHOT_LIST_URL = '/api/hosts/:host_id/snapshots/';
|
3
|
+
export const SNAPSHOT_DELETE = 'FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_DELETE';
|
4
|
+
export const SNAPSHOT_DELETE_URL = '/api/hosts/%s/snapshots/%s/';
|
5
|
+
export const SNAPSHOT_UPDATE = 'FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_UPDATE';
|
6
|
+
export const SNAPSHOT_UPDATE_URL = '/api/hosts/%s/snapshots/%s/';
|
7
|
+
export const SNAPSHOT_ROLLBACK =
|
8
|
+
'FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_ROLLBACK';
|
9
|
+
export const SNAPSHOT_ROLLBACK_URL = '/api/hosts/%s/snapshots/%s/revert';
|
@@ -0,0 +1,100 @@
|
|
1
|
+
// This is an example for a generic redux's reducer
|
2
|
+
// Reducers should be registered to foreman-core
|
3
|
+
// For a further registration demonstration, have a look in `webpack/global_index.js`
|
4
|
+
|
5
|
+
import Immutable from 'seamless-immutable';
|
6
|
+
import { cloneDeep, findIndex } from 'lodash';
|
7
|
+
|
8
|
+
import { actionTypeGenerator } from 'foremanReact/redux/API';
|
9
|
+
|
10
|
+
import {
|
11
|
+
SNAPSHOT_LIST,
|
12
|
+
SNAPSHOT_DELETE,
|
13
|
+
SNAPSHOT_UPDATE,
|
14
|
+
SNAPSHOT_ROLLBACK,
|
15
|
+
} from './SnapshotManagementConstants';
|
16
|
+
|
17
|
+
export const initialState = Immutable({
|
18
|
+
isLoading: true,
|
19
|
+
isWorking: false,
|
20
|
+
hasError: false,
|
21
|
+
snapshots: [],
|
22
|
+
});
|
23
|
+
|
24
|
+
export default (state = initialState, action) => {
|
25
|
+
const { response } = action;
|
26
|
+
|
27
|
+
const listTypes = actionTypeGenerator(SNAPSHOT_LIST);
|
28
|
+
const deleteTypes = actionTypeGenerator(SNAPSHOT_DELETE);
|
29
|
+
const updateTypes = actionTypeGenerator(SNAPSHOT_UPDATE);
|
30
|
+
const rollbackTypes = actionTypeGenerator(SNAPSHOT_ROLLBACK);
|
31
|
+
|
32
|
+
switch (action.type) {
|
33
|
+
case 'SNAPSHOT_FORM_SUBMITTED':
|
34
|
+
return state.merge({
|
35
|
+
needsReload: true,
|
36
|
+
});
|
37
|
+
case listTypes.REQUEST:
|
38
|
+
return state.merge({
|
39
|
+
snapshots: [],
|
40
|
+
isLoading: true,
|
41
|
+
hasError: false,
|
42
|
+
needsReload: false,
|
43
|
+
});
|
44
|
+
case listTypes.SUCCESS:
|
45
|
+
return state.merge({
|
46
|
+
snapshots: response.results,
|
47
|
+
isLoading: false,
|
48
|
+
needsReload: false,
|
49
|
+
});
|
50
|
+
case listTypes.FAILURE:
|
51
|
+
return state.merge({
|
52
|
+
error: response,
|
53
|
+
hasError: true,
|
54
|
+
isLoading: false,
|
55
|
+
needsReload: false,
|
56
|
+
});
|
57
|
+
case deleteTypes.REQUEST:
|
58
|
+
return state.merge({
|
59
|
+
isWorking: true,
|
60
|
+
});
|
61
|
+
case deleteTypes.SUCCESS:
|
62
|
+
case deleteTypes.FAILURE:
|
63
|
+
return state.merge({
|
64
|
+
isWorking: false,
|
65
|
+
});
|
66
|
+
case updateTypes.REQUEST:
|
67
|
+
return state.merge({
|
68
|
+
isWorking: true,
|
69
|
+
});
|
70
|
+
case updateTypes.SUCCESS: {
|
71
|
+
const snapshots = cloneDeep(state.snapshots);
|
72
|
+
const index = findIndex(snapshots, { id: response.id });
|
73
|
+
|
74
|
+
snapshots[index].name = response.name;
|
75
|
+
snapshots[index].description = response.description;
|
76
|
+
|
77
|
+
return state.merge({
|
78
|
+
isWorking: false,
|
79
|
+
snapshots,
|
80
|
+
});
|
81
|
+
}
|
82
|
+
case updateTypes.FAILURE:
|
83
|
+
return state.merge({
|
84
|
+
isWorking: false,
|
85
|
+
});
|
86
|
+
case rollbackTypes.REQUEST:
|
87
|
+
return state.merge({
|
88
|
+
snapshots: state.snapshots,
|
89
|
+
isWorking: true,
|
90
|
+
});
|
91
|
+
case rollbackTypes.SUCCESS:
|
92
|
+
case rollbackTypes.FAILURE:
|
93
|
+
return state.merge({
|
94
|
+
snapshots: state.snapshots,
|
95
|
+
isWorking: false,
|
96
|
+
});
|
97
|
+
default:
|
98
|
+
return state;
|
99
|
+
}
|
100
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
const snapshotMgmt = state => state.foremanSnapshotManagement;
|
2
|
+
|
3
|
+
export const selectSnapshots = state => snapshotMgmt(state).snapshots;
|
4
|
+
export const selectIsLoading = state => snapshotMgmt(state).isLoading;
|
5
|
+
export const selectIsWorking = state => snapshotMgmt(state).isWorking;
|
6
|
+
export const selectHasError = state => snapshotMgmt(state).hasError;
|
7
|
+
export const selectError = state => snapshotMgmt(state).error;
|
8
|
+
export const selectNeedsReload = state => snapshotMgmt(state).needsReload;
|
@@ -0,0 +1,123 @@
|
|
1
|
+
import { testActionSnapshotWithFixtures } from 'react-redux-test-utils';
|
2
|
+
import { API } from 'foremanReact/redux/API';
|
3
|
+
|
4
|
+
import {
|
5
|
+
loadSnapshotList,
|
6
|
+
snapshotDeleteAction,
|
7
|
+
snapshotRollbackAction,
|
8
|
+
snapshotUpdateAction,
|
9
|
+
} from '../SnapshotManagementActions';
|
10
|
+
|
11
|
+
jest.mock('foremanReact/redux/API/API');
|
12
|
+
|
13
|
+
const successResponse = {
|
14
|
+
data: 'some-data',
|
15
|
+
};
|
16
|
+
|
17
|
+
const doLoadSnapshotList = (hostId, serverMock) => {
|
18
|
+
API.get.mockImplementation(serverMock);
|
19
|
+
|
20
|
+
return loadSnapshotList(hostId);
|
21
|
+
};
|
22
|
+
|
23
|
+
const doDeleteSnapshot = (host, rowData, serverMock) => {
|
24
|
+
API.delete.mockImplementation(serverMock);
|
25
|
+
|
26
|
+
return snapshotDeleteAction(host, rowData);
|
27
|
+
};
|
28
|
+
|
29
|
+
const doRollbackSnapshot = (host, rowData, serverMock) => {
|
30
|
+
API.put.mockImplementation(serverMock);
|
31
|
+
|
32
|
+
return snapshotRollbackAction(host, rowData);
|
33
|
+
};
|
34
|
+
|
35
|
+
const doUpdateSnapshot = (host, rowData, serverMock) => {
|
36
|
+
API.put.mockImplementation(serverMock);
|
37
|
+
|
38
|
+
return snapshotUpdateAction(host, rowData);
|
39
|
+
};
|
40
|
+
|
41
|
+
const listFixtures = {
|
42
|
+
'should load snapshots and success': () =>
|
43
|
+
doLoadSnapshotList(42, async () => successResponse),
|
44
|
+
|
45
|
+
'should load snapshots and fail': () =>
|
46
|
+
doLoadSnapshotList(42, async () => {
|
47
|
+
throw new Error('some-error');
|
48
|
+
}),
|
49
|
+
};
|
50
|
+
|
51
|
+
describe('Snapshot list actions', () =>
|
52
|
+
testActionSnapshotWithFixtures(listFixtures));
|
53
|
+
|
54
|
+
const deleteFixtures = {
|
55
|
+
'should delete snapshot and success': () =>
|
56
|
+
doDeleteSnapshot(
|
57
|
+
{ id: 42, name: 'deep.thought' },
|
58
|
+
{ id: 'snapshot-0815', name: 'Savegame' },
|
59
|
+
async () => successResponse
|
60
|
+
),
|
61
|
+
|
62
|
+
'should load snapshots and fail': () =>
|
63
|
+
doDeleteSnapshot(
|
64
|
+
{ id: 42, name: 'deep.thought' },
|
65
|
+
{ id: 'snapshot-0815', name: 'Savegame' },
|
66
|
+
async () => {
|
67
|
+
throw new Error('some-error');
|
68
|
+
}
|
69
|
+
),
|
70
|
+
};
|
71
|
+
|
72
|
+
describe('Snapshot snapshot-delete actions', () =>
|
73
|
+
testActionSnapshotWithFixtures(deleteFixtures));
|
74
|
+
|
75
|
+
const rollbackFixtures = {
|
76
|
+
'should rollback snapshot and success': () =>
|
77
|
+
doRollbackSnapshot(
|
78
|
+
{ id: 42, name: 'deep.thought' },
|
79
|
+
{ id: 'snapshot-0815', name: 'Savegame' },
|
80
|
+
async () => successResponse
|
81
|
+
),
|
82
|
+
|
83
|
+
'should load snapshots and fail': () =>
|
84
|
+
doRollbackSnapshot(
|
85
|
+
{ id: 42, name: 'deep.thought' },
|
86
|
+
{ id: 'snapshot-0815', name: 'Savegame' },
|
87
|
+
async () => {
|
88
|
+
throw new Error('some-error');
|
89
|
+
}
|
90
|
+
),
|
91
|
+
};
|
92
|
+
|
93
|
+
describe('Snapshot snapshot-rollback actions', () =>
|
94
|
+
testActionSnapshotWithFixtures(rollbackFixtures));
|
95
|
+
|
96
|
+
const updateFixtures = {
|
97
|
+
'should update snapshot and success': () =>
|
98
|
+
doUpdateSnapshot(
|
99
|
+
{ id: 42, name: 'deep.thought' },
|
100
|
+
{
|
101
|
+
id: 'snapshot-0815',
|
102
|
+
name: 'Savegame',
|
103
|
+
description: 'Saw the three headed monkey!',
|
104
|
+
},
|
105
|
+
async () => successResponse
|
106
|
+
),
|
107
|
+
|
108
|
+
'should load snapshots and fail': () =>
|
109
|
+
doUpdateSnapshot(
|
110
|
+
{ id: 42, name: 'deep.thought' },
|
111
|
+
{
|
112
|
+
id: 'snapshot-0815',
|
113
|
+
name: 'Savegame',
|
114
|
+
description: 'Saw the three headed monkey!',
|
115
|
+
},
|
116
|
+
async () => {
|
117
|
+
throw new Error('some-error');
|
118
|
+
}
|
119
|
+
),
|
120
|
+
};
|
121
|
+
|
122
|
+
describe('Snapshot snapshot-update actions', () =>
|
123
|
+
testActionSnapshotWithFixtures(updateFixtures));
|
@@ -0,0 +1,157 @@
|
|
1
|
+
import { testReducerSnapshotWithFixtures } from 'react-redux-test-utils';
|
2
|
+
import Immutable from 'seamless-immutable';
|
3
|
+
|
4
|
+
import { actionTypeGenerator } from 'foremanReact/redux/API';
|
5
|
+
|
6
|
+
import {
|
7
|
+
SNAPSHOT_LIST,
|
8
|
+
SNAPSHOT_DELETE,
|
9
|
+
SNAPSHOT_ROLLBACK,
|
10
|
+
SNAPSHOT_UPDATE,
|
11
|
+
} from '../SnapshotManagementConstants';
|
12
|
+
import reducer, { initialState } from '../SnapshotManagementReducer';
|
13
|
+
|
14
|
+
const listTypes = actionTypeGenerator(SNAPSHOT_LIST);
|
15
|
+
const deleteTypes = actionTypeGenerator(SNAPSHOT_DELETE);
|
16
|
+
const rollbackTypes = actionTypeGenerator(SNAPSHOT_ROLLBACK);
|
17
|
+
const updateTypes = actionTypeGenerator(SNAPSHOT_UPDATE);
|
18
|
+
|
19
|
+
const idleState = Immutable({
|
20
|
+
isLoading: false,
|
21
|
+
isWorking: false,
|
22
|
+
hasError: false,
|
23
|
+
snapshots: [
|
24
|
+
{
|
25
|
+
id: 'snapshot-15776',
|
26
|
+
name: 'test',
|
27
|
+
description: '123 testSnapshot',
|
28
|
+
created_at: '2021-01-19 15:03:47 UTC',
|
29
|
+
parent_id: null,
|
30
|
+
children_ids: null,
|
31
|
+
},
|
32
|
+
],
|
33
|
+
});
|
34
|
+
|
35
|
+
const fixtures = {
|
36
|
+
'should return initial state': {
|
37
|
+
state: initialState,
|
38
|
+
action: {
|
39
|
+
type: undefined,
|
40
|
+
payload: {},
|
41
|
+
},
|
42
|
+
},
|
43
|
+
'should handle LIST_REQUEST': {
|
44
|
+
state: idleState,
|
45
|
+
action: {
|
46
|
+
type: listTypes.REQUEST,
|
47
|
+
// response: ,
|
48
|
+
},
|
49
|
+
},
|
50
|
+
'should handle LIST_SUCCESS': {
|
51
|
+
state: idleState,
|
52
|
+
action: {
|
53
|
+
type: listTypes.SUCCESS,
|
54
|
+
payload: {},
|
55
|
+
response: {
|
56
|
+
results: [],
|
57
|
+
},
|
58
|
+
},
|
59
|
+
},
|
60
|
+
'should handle LIST_FAILURE': {
|
61
|
+
state: idleState,
|
62
|
+
action: {
|
63
|
+
type: listTypes.FAILURE,
|
64
|
+
payload: {},
|
65
|
+
response: {
|
66
|
+
message: 'Something went wrong',
|
67
|
+
},
|
68
|
+
},
|
69
|
+
},
|
70
|
+
'should handle ROLLBACK_REQUEST': {
|
71
|
+
state: idleState,
|
72
|
+
action: {
|
73
|
+
type: rollbackTypes.REQUEST,
|
74
|
+
// response: ,
|
75
|
+
},
|
76
|
+
},
|
77
|
+
'should handle ROLLBACK_SUCCESS': {
|
78
|
+
state: idleState,
|
79
|
+
action: {
|
80
|
+
type: rollbackTypes.SUCCESS,
|
81
|
+
payload: {},
|
82
|
+
response: {
|
83
|
+
results: [],
|
84
|
+
},
|
85
|
+
},
|
86
|
+
},
|
87
|
+
'should handle ROLLBACK_FAILURE': {
|
88
|
+
state: idleState,
|
89
|
+
action: {
|
90
|
+
type: rollbackTypes.FAILURE,
|
91
|
+
payload: {},
|
92
|
+
response: {
|
93
|
+
message: 'Something went wrong',
|
94
|
+
},
|
95
|
+
},
|
96
|
+
},
|
97
|
+
'should handle DELETE_REQUEST': {
|
98
|
+
state: idleState,
|
99
|
+
action: {
|
100
|
+
type: deleteTypes.REQUEST,
|
101
|
+
// response: ,
|
102
|
+
},
|
103
|
+
},
|
104
|
+
'should handle DELETE_SUCCESS': {
|
105
|
+
state: idleState,
|
106
|
+
action: {
|
107
|
+
type: deleteTypes.SUCCESS,
|
108
|
+
payload: {},
|
109
|
+
response: {
|
110
|
+
results: [],
|
111
|
+
},
|
112
|
+
},
|
113
|
+
},
|
114
|
+
'should handle DELETE_FAILURE': {
|
115
|
+
state: idleState,
|
116
|
+
action: {
|
117
|
+
type: deleteTypes.FAILURE,
|
118
|
+
payload: {},
|
119
|
+
response: {
|
120
|
+
message: 'Something went wrong',
|
121
|
+
},
|
122
|
+
},
|
123
|
+
},
|
124
|
+
'should handle UPDATE_REQUEST': {
|
125
|
+
state: idleState,
|
126
|
+
action: {
|
127
|
+
type: updateTypes.REQUEST,
|
128
|
+
// response: ,
|
129
|
+
},
|
130
|
+
},
|
131
|
+
'should handle UPDATE_SUCCESS': {
|
132
|
+
state: idleState,
|
133
|
+
action: {
|
134
|
+
type: updateTypes.SUCCESS,
|
135
|
+
payload: {},
|
136
|
+
response: {
|
137
|
+
id: 'snapshot-15776',
|
138
|
+
name: 'test snapshot',
|
139
|
+
description: 'My most important snapshot.',
|
140
|
+
created_at: '2021-01-19 15:03:47 UTC',
|
141
|
+
},
|
142
|
+
},
|
143
|
+
},
|
144
|
+
'should handle UPDATE_FAILURE': {
|
145
|
+
state: idleState,
|
146
|
+
action: {
|
147
|
+
type: updateTypes.FAILURE,
|
148
|
+
payload: {},
|
149
|
+
response: {
|
150
|
+
message: 'Something went wrong',
|
151
|
+
},
|
152
|
+
},
|
153
|
+
},
|
154
|
+
};
|
155
|
+
|
156
|
+
describe('SnapshotManagementReducer', () =>
|
157
|
+
testReducerSnapshotWithFixtures(reducer, fixtures));
|
@@ -0,0 +1,314 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`Snapshot list actions should load snapshots and fail 1`] = `
|
4
|
+
Array [
|
5
|
+
Array [
|
6
|
+
Object {
|
7
|
+
"payload": Object {
|
8
|
+
"hostId": 42,
|
9
|
+
},
|
10
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_LIST_REQUEST",
|
11
|
+
},
|
12
|
+
],
|
13
|
+
Array [
|
14
|
+
Object {
|
15
|
+
"payload": Object {
|
16
|
+
"hostId": 42,
|
17
|
+
},
|
18
|
+
"response": [Error: some-error],
|
19
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_LIST_FAILURE",
|
20
|
+
},
|
21
|
+
],
|
22
|
+
]
|
23
|
+
`;
|
24
|
+
|
25
|
+
exports[`Snapshot list actions should load snapshots and success 1`] = `
|
26
|
+
Array [
|
27
|
+
Array [
|
28
|
+
Object {
|
29
|
+
"payload": Object {
|
30
|
+
"hostId": 42,
|
31
|
+
},
|
32
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_LIST_REQUEST",
|
33
|
+
},
|
34
|
+
],
|
35
|
+
Array [
|
36
|
+
Object {
|
37
|
+
"payload": Object {
|
38
|
+
"hostId": 42,
|
39
|
+
},
|
40
|
+
"response": "some-data",
|
41
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_LIST_SUCCESS",
|
42
|
+
},
|
43
|
+
],
|
44
|
+
]
|
45
|
+
`;
|
46
|
+
|
47
|
+
exports[`Snapshot snapshot-delete actions should delete snapshot and success 1`] = `
|
48
|
+
Array [
|
49
|
+
Array [
|
50
|
+
Object {
|
51
|
+
"payload": Object {
|
52
|
+
"host": Object {
|
53
|
+
"id": 42,
|
54
|
+
"name": "deep.thought",
|
55
|
+
},
|
56
|
+
"id": "snapshot-0815",
|
57
|
+
},
|
58
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_DELETE_REQUEST",
|
59
|
+
},
|
60
|
+
],
|
61
|
+
Array [
|
62
|
+
Object {
|
63
|
+
"payload": Object {
|
64
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_DELETE_SUCCESS",
|
65
|
+
"message": Object {
|
66
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_DELETE_SUCCESS",
|
67
|
+
"message": "Successfully removed Snapshot \\"Savegame\\" from host deep.thought",
|
68
|
+
"type": "success",
|
69
|
+
},
|
70
|
+
},
|
71
|
+
"type": "TOASTS_ADD",
|
72
|
+
},
|
73
|
+
],
|
74
|
+
Array [
|
75
|
+
[Function],
|
76
|
+
],
|
77
|
+
Array [
|
78
|
+
Object {
|
79
|
+
"payload": Object {
|
80
|
+
"host": Object {
|
81
|
+
"id": 42,
|
82
|
+
"name": "deep.thought",
|
83
|
+
},
|
84
|
+
"id": "snapshot-0815",
|
85
|
+
},
|
86
|
+
"response": "some-data",
|
87
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_DELETE_SUCCESS",
|
88
|
+
},
|
89
|
+
],
|
90
|
+
]
|
91
|
+
`;
|
92
|
+
|
93
|
+
exports[`Snapshot snapshot-delete actions should load snapshots and fail 1`] = `
|
94
|
+
Array [
|
95
|
+
Array [
|
96
|
+
Object {
|
97
|
+
"payload": Object {
|
98
|
+
"host": Object {
|
99
|
+
"id": 42,
|
100
|
+
"name": "deep.thought",
|
101
|
+
},
|
102
|
+
"id": "snapshot-0815",
|
103
|
+
},
|
104
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_DELETE_REQUEST",
|
105
|
+
},
|
106
|
+
],
|
107
|
+
Array [
|
108
|
+
Object {
|
109
|
+
"payload": Object {
|
110
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_DELETE_FAILURE",
|
111
|
+
"message": Object {
|
112
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_DELETE_FAILURE",
|
113
|
+
"message": "Error occurred while removing Snapshot: Error: some-error",
|
114
|
+
"type": "error",
|
115
|
+
},
|
116
|
+
},
|
117
|
+
"type": "TOASTS_ADD",
|
118
|
+
},
|
119
|
+
],
|
120
|
+
Array [
|
121
|
+
Object {
|
122
|
+
"payload": Object {
|
123
|
+
"host": Object {
|
124
|
+
"id": 42,
|
125
|
+
"name": "deep.thought",
|
126
|
+
},
|
127
|
+
"id": "snapshot-0815",
|
128
|
+
},
|
129
|
+
"response": [Error: some-error],
|
130
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_DELETE_FAILURE",
|
131
|
+
},
|
132
|
+
],
|
133
|
+
]
|
134
|
+
`;
|
135
|
+
|
136
|
+
exports[`Snapshot snapshot-rollback actions should load snapshots and fail 1`] = `
|
137
|
+
Array [
|
138
|
+
Array [
|
139
|
+
Object {
|
140
|
+
"payload": Object {
|
141
|
+
"host": Object {
|
142
|
+
"id": 42,
|
143
|
+
"name": "deep.thought",
|
144
|
+
},
|
145
|
+
"id": "snapshot-0815",
|
146
|
+
},
|
147
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_ROLLBACK_REQUEST",
|
148
|
+
},
|
149
|
+
],
|
150
|
+
Array [
|
151
|
+
Object {
|
152
|
+
"payload": Object {
|
153
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_ROLLBACK_FAILURE",
|
154
|
+
"message": Object {
|
155
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_ROLLBACK_FAILURE",
|
156
|
+
"message": "Error occurred while rolling back VM: Error: some-error",
|
157
|
+
"type": "error",
|
158
|
+
},
|
159
|
+
},
|
160
|
+
"type": "TOASTS_ADD",
|
161
|
+
},
|
162
|
+
],
|
163
|
+
Array [
|
164
|
+
Object {
|
165
|
+
"payload": Object {
|
166
|
+
"host": Object {
|
167
|
+
"id": 42,
|
168
|
+
"name": "deep.thought",
|
169
|
+
},
|
170
|
+
"id": "snapshot-0815",
|
171
|
+
},
|
172
|
+
"response": [Error: some-error],
|
173
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_ROLLBACK_FAILURE",
|
174
|
+
},
|
175
|
+
],
|
176
|
+
]
|
177
|
+
`;
|
178
|
+
|
179
|
+
exports[`Snapshot snapshot-rollback actions should rollback snapshot and success 1`] = `
|
180
|
+
Array [
|
181
|
+
Array [
|
182
|
+
Object {
|
183
|
+
"payload": Object {
|
184
|
+
"host": Object {
|
185
|
+
"id": 42,
|
186
|
+
"name": "deep.thought",
|
187
|
+
},
|
188
|
+
"id": "snapshot-0815",
|
189
|
+
},
|
190
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_ROLLBACK_REQUEST",
|
191
|
+
},
|
192
|
+
],
|
193
|
+
Array [
|
194
|
+
Object {
|
195
|
+
"payload": Object {
|
196
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_ROLLBACK_SUCCESS",
|
197
|
+
"message": Object {
|
198
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_ROLLBACK_SUCCESS",
|
199
|
+
"message": "Successfully rolled back Snapshot \\"Savegame\\" on host deep.thought",
|
200
|
+
"type": "success",
|
201
|
+
},
|
202
|
+
},
|
203
|
+
"type": "TOASTS_ADD",
|
204
|
+
},
|
205
|
+
],
|
206
|
+
Array [
|
207
|
+
Object {
|
208
|
+
"payload": Object {
|
209
|
+
"host": Object {
|
210
|
+
"id": 42,
|
211
|
+
"name": "deep.thought",
|
212
|
+
},
|
213
|
+
"id": "snapshot-0815",
|
214
|
+
},
|
215
|
+
"response": "some-data",
|
216
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_ROLLBACK_SUCCESS",
|
217
|
+
},
|
218
|
+
],
|
219
|
+
]
|
220
|
+
`;
|
221
|
+
|
222
|
+
exports[`Snapshot snapshot-update actions should load snapshots and fail 1`] = `
|
223
|
+
Array [
|
224
|
+
Array [
|
225
|
+
Object {
|
226
|
+
"payload": Object {
|
227
|
+
"host": Object {
|
228
|
+
"id": 42,
|
229
|
+
"name": "deep.thought",
|
230
|
+
},
|
231
|
+
"id": "snapshot-0815",
|
232
|
+
"snapshot": Object {
|
233
|
+
"description": "Saw the three headed monkey!",
|
234
|
+
"name": "Savegame",
|
235
|
+
},
|
236
|
+
},
|
237
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_UPDATE_REQUEST",
|
238
|
+
},
|
239
|
+
],
|
240
|
+
Array [
|
241
|
+
Object {
|
242
|
+
"payload": Object {
|
243
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_UPDATE_FAILURE",
|
244
|
+
"message": Object {
|
245
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_UPDATE_FAILURE",
|
246
|
+
"message": "Error occurred while updating Snapshot: Error: some-error",
|
247
|
+
"type": "error",
|
248
|
+
},
|
249
|
+
},
|
250
|
+
"type": "TOASTS_ADD",
|
251
|
+
},
|
252
|
+
],
|
253
|
+
Array [
|
254
|
+
Object {
|
255
|
+
"payload": Object {
|
256
|
+
"host": Object {
|
257
|
+
"id": 42,
|
258
|
+
"name": "deep.thought",
|
259
|
+
},
|
260
|
+
"id": "snapshot-0815",
|
261
|
+
},
|
262
|
+
"response": [Error: some-error],
|
263
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_UPDATE_FAILURE",
|
264
|
+
},
|
265
|
+
],
|
266
|
+
]
|
267
|
+
`;
|
268
|
+
|
269
|
+
exports[`Snapshot snapshot-update actions should update snapshot and success 1`] = `
|
270
|
+
Array [
|
271
|
+
Array [
|
272
|
+
Object {
|
273
|
+
"payload": Object {
|
274
|
+
"host": Object {
|
275
|
+
"id": 42,
|
276
|
+
"name": "deep.thought",
|
277
|
+
},
|
278
|
+
"id": "snapshot-0815",
|
279
|
+
"snapshot": Object {
|
280
|
+
"description": "Saw the three headed monkey!",
|
281
|
+
"name": "Savegame",
|
282
|
+
},
|
283
|
+
},
|
284
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_UPDATE_REQUEST",
|
285
|
+
},
|
286
|
+
],
|
287
|
+
Array [
|
288
|
+
Object {
|
289
|
+
"payload": Object {
|
290
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_UPDATE_SUCCESS",
|
291
|
+
"message": Object {
|
292
|
+
"key": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_UPDATE_SUCCESS",
|
293
|
+
"message": "Successfully updated Snapshot \\"Savegame\\"",
|
294
|
+
"type": "success",
|
295
|
+
},
|
296
|
+
},
|
297
|
+
"type": "TOASTS_ADD",
|
298
|
+
},
|
299
|
+
],
|
300
|
+
Array [
|
301
|
+
Object {
|
302
|
+
"payload": Object {
|
303
|
+
"host": Object {
|
304
|
+
"id": 42,
|
305
|
+
"name": "deep.thought",
|
306
|
+
},
|
307
|
+
"id": "snapshot-0815",
|
308
|
+
},
|
309
|
+
"response": "some-data",
|
310
|
+
"type": "FOREMAN_SNAPSHOT_MANAGEMENT_SNAPSHOT_UPDATE_SUCCESS",
|
311
|
+
},
|
312
|
+
],
|
313
|
+
]
|
314
|
+
`;
|