|
| 1 | +/* eslint-disable @cspell/spellchecker */ |
| 2 | +import { PlanData } from 'src/modules/Plans/utils'; |
| 3 | +import { |
| 4 | + PlanConditionCategory, |
| 5 | + PlanConditionType, |
| 6 | +} from 'src/modules/Plans/utils/types/PlanCondition'; |
| 7 | + |
| 8 | +import { V1beta1Migration, V1beta1MigrationStatusVms } from '@kubev2v/types'; |
| 9 | + |
| 10 | +export const mockFailedVm: V1beta1MigrationStatusVms = { |
| 11 | + started: '2025-01-14T06:37:20Z', |
| 12 | + pipeline: [], |
| 13 | + error: { |
| 14 | + phase: 'CopyDisks', |
| 15 | + reasons: [ |
| 16 | + 'Unable to process data: Unable to transfer source data to scratch space: failed to pull image: unexpected EOF', |
| 17 | + ], |
| 18 | + }, |
| 19 | + completed: '2025-01-14T08:38:41Z', |
| 20 | + name: 'winweb01', |
| 21 | + conditions: [ |
| 22 | + { |
| 23 | + category: PlanConditionCategory.Advisory, |
| 24 | + durable: true, |
| 25 | + lastTransitionTime: '2025-01-14T08:38:38Z', |
| 26 | + message: 'The VM migration has FAILED.', |
| 27 | + status: 'True', |
| 28 | + type: PlanConditionType.Failed, |
| 29 | + }, |
| 30 | + ], |
| 31 | + restorePowerState: 'On', |
| 32 | + id: '616e985a-170f-471b-b538-c39f8d848559', |
| 33 | + namespace: 'vmimported', |
| 34 | + phase: 'Completed', |
| 35 | +}; |
| 36 | + |
| 37 | +export const mockSucceededVm: V1beta1MigrationStatusVms = { |
| 38 | + started: '2025-01-07T18:42:50Z', |
| 39 | + pipeline: [], |
| 40 | + completed: '2025-01-07T18:54:14Z', |
| 41 | + name: 'haproxy-cf5d4', |
| 42 | + luks: {}, |
| 43 | + conditions: [ |
| 44 | + { |
| 45 | + category: PlanConditionCategory.Advisory, |
| 46 | + durable: true, |
| 47 | + lastTransitionTime: '2025-01-07T18:54:14Z', |
| 48 | + message: 'The VM migration has SUCCEEDED.', |
| 49 | + status: 'True', |
| 50 | + type: PlanConditionType.Succeeded, |
| 51 | + }, |
| 52 | + ], |
| 53 | + restorePowerState: 'Off', |
| 54 | + id: 'vm-146146', |
| 55 | + phase: 'Completed', |
| 56 | +}; |
| 57 | + |
| 58 | +export const mockPlanData: PlanData = { |
| 59 | + obj: { |
| 60 | + kind: 'Plan', |
| 61 | + apiVersion: 'forklift.konveyor.io/v1beta1', |
| 62 | + metadata: { |
| 63 | + annotations: { populatorLabels: 'True' }, |
| 64 | + creationTimestamp: '2025-01-14T15:29:38Z', |
| 65 | + generation: 2, |
| 66 | + managedFields: [], |
| 67 | + name: 'testing', |
| 68 | + namespace: 'openshift-mtv', |
| 69 | + resourceVersion: '20558300', |
| 70 | + uid: '342f3ad5-eac9-4f89-8f1e-a37bee91f16a', |
| 71 | + }, |
| 72 | + spec: { |
| 73 | + map: { |
| 74 | + network: { |
| 75 | + apiVersion: 'forklift.konveyor.io/v1beta1', |
| 76 | + kind: 'NetworkMap', |
| 77 | + name: 'vmware-wd2q7', |
| 78 | + namespace: 'openshift-mtv', |
| 79 | + uid: '2fe5e6cc-3a63-4034-8828-a7d38ac8f3c2', |
| 80 | + }, |
| 81 | + storage: { |
| 82 | + apiVersion: 'forklift.konveyor.io/v1beta1', |
| 83 | + kind: 'StorageMap', |
| 84 | + name: 'vmware-k2bmn', |
| 85 | + namespace: 'openshift-mtv', |
| 86 | + uid: '7cf7f014-7d5e-47a4-99a4-57c14fdceeb6', |
| 87 | + }, |
| 88 | + }, |
| 89 | + provider: { |
| 90 | + destination: { |
| 91 | + apiVersion: 'forklift.konveyor.io/v1beta1', |
| 92 | + kind: 'Provider', |
| 93 | + name: 'host', |
| 94 | + namespace: 'openshift-mtv', |
| 95 | + uid: 'adf42f04-b5dd-41a6-8626-642686c0145a', |
| 96 | + }, |
| 97 | + source: { |
| 98 | + apiVersion: 'forklift.konveyor.io/v1beta1', |
| 99 | + kind: 'Provider', |
| 100 | + name: 'vmware', |
| 101 | + namespace: 'openshift-mtv', |
| 102 | + uid: 'a14fc19a-0332-4cf2-bd91-6ceb3a7e8f47', |
| 103 | + }, |
| 104 | + }, |
| 105 | + targetNamespace: 'openshift-mtv', |
| 106 | + vms: [{ id: 'vm-146147', name: 'database-cf5d4' }], |
| 107 | + warm: true, |
| 108 | + }, |
| 109 | + status: { |
| 110 | + conditions: [ |
| 111 | + { |
| 112 | + category: PlanConditionCategory.Critical, |
| 113 | + items: [" id:vm-146147 name:'database-cf5d4' "], |
| 114 | + lastTransitionTime: '2025-01-14T15:29:38Z', |
| 115 | + message: 'Target VM already exists.', |
| 116 | + reason: 'NotUnique', |
| 117 | + status: 'True', |
| 118 | + type: PlanConditionType.VMAlreadyExists, |
| 119 | + }, |
| 120 | + ], |
| 121 | + migration: {}, |
| 122 | + observedGeneration: 2, |
| 123 | + }, |
| 124 | + }, |
| 125 | + permissions: { canCreate: true, canPatch: true, canDelete: true, canGet: true, loading: false }, |
| 126 | +}; |
| 127 | + |
| 128 | +export const mockMigration: V1beta1Migration = { |
| 129 | + kind: 'Migration', |
| 130 | + apiVersion: 'forklift.konveyor.io/v1beta1', |
| 131 | + metadata: { |
| 132 | + generateName: 'test1-', |
| 133 | + resourceVersion: '28653414', |
| 134 | + name: 'test1-j5w4l', |
| 135 | + uid: '193b4e36-6b14-4a09-8675-6d587019a747', |
| 136 | + creationTimestamp: '2025-01-14T06:44:23Z', |
| 137 | + generation: 1, |
| 138 | + managedFields: [], |
| 139 | + namespace: 'openshift-mtv', |
| 140 | + ownerReferences: [], |
| 141 | + }, |
| 142 | + spec: { |
| 143 | + plan: { |
| 144 | + name: 'test1', |
| 145 | + namespace: 'openshift-mtv', |
| 146 | + uid: 'fd4b5f8b-d28c-4b51-a663-c3e011bfb666', |
| 147 | + }, |
| 148 | + }, |
| 149 | + status: { |
| 150 | + conditions: [ |
| 151 | + { |
| 152 | + category: PlanConditionCategory.Required, |
| 153 | + lastTransitionTime: '2025-01-14T06:44:23Z', |
| 154 | + message: 'The migration is ready.', |
| 155 | + status: 'True', |
| 156 | + type: PlanConditionType.Ready, |
| 157 | + }, |
| 158 | + { |
| 159 | + category: PlanConditionCategory.Advisory, |
| 160 | + lastTransitionTime: '2025-01-14T06:44:23Z', |
| 161 | + message: 'The migration is RUNNING.', |
| 162 | + status: 'True', |
| 163 | + type: PlanConditionType.Running, |
| 164 | + }, |
| 165 | + ], |
| 166 | + started: '2025-01-14T06:44:23Z', |
| 167 | + vms: [ |
| 168 | + { |
| 169 | + id: '637c61c3-8501-405e-a35a-873520085a6b', |
| 170 | + luks: {}, |
| 171 | + name: 'database', |
| 172 | + namespace: 'vmimported', |
| 173 | + phase: 'CopyDisks', |
| 174 | + pipeline: [ |
| 175 | + { |
| 176 | + completed: '2025-01-14T06:44:47Z', |
| 177 | + description: 'Initialize migration.', |
| 178 | + name: 'Initialize', |
| 179 | + phase: 'Completed', |
| 180 | + progress: { |
| 181 | + completed: 0, |
| 182 | + total: 1, |
| 183 | + }, |
| 184 | + started: '2025-01-14T06:44:23Z', |
| 185 | + }, |
| 186 | + { |
| 187 | + annotations: { |
| 188 | + unit: 'MB', |
| 189 | + }, |
| 190 | + description: 'Transfer disks.', |
| 191 | + name: 'DiskTransfer', |
| 192 | + phase: 'Running', |
| 193 | + progress: { |
| 194 | + completed: 0, |
| 195 | + total: 16384, |
| 196 | + }, |
| 197 | + started: '2025-01-14T06:44:50Z', |
| 198 | + tasks: [ |
| 199 | + { |
| 200 | + annotations: { |
| 201 | + unit: 'MB', |
| 202 | + }, |
| 203 | + name: 'vmimported/database', |
| 204 | + phase: 'Running', |
| 205 | + progress: { |
| 206 | + completed: 0, |
| 207 | + total: 16384, |
| 208 | + }, |
| 209 | + reason: |
| 210 | + 'Error; Unable to connect to http data source: expected status code 200, got 404. Status: 404 Not Found', |
| 211 | + started: '2025-01-14T06:45:26Z', |
| 212 | + }, |
| 213 | + ], |
| 214 | + }, |
| 215 | + { |
| 216 | + description: 'Create VM.', |
| 217 | + name: 'VirtualMachineCreation', |
| 218 | + phase: 'Pending', |
| 219 | + progress: { |
| 220 | + completed: 0, |
| 221 | + total: 1, |
| 222 | + }, |
| 223 | + }, |
| 224 | + ], |
| 225 | + restorePowerState: 'On', |
| 226 | + started: '2025-01-14T06:44:23Z', |
| 227 | + }, |
| 228 | + ], |
| 229 | + }, |
| 230 | +}; |
0 commit comments