|
1 | 1 | import { join } from 'path' |
2 | 2 | import omit from 'lodash.omit' |
3 | 3 | import isEmpty from 'lodash.isempty' |
4 | | -import cloneDeep from 'lodash.clonedeep' |
5 | | -import merge from 'lodash.merge' |
6 | 4 | import { |
7 | 5 | collectData, |
8 | 6 | collectCheckpointPlotsData, |
9 | 7 | collectTemplates, |
10 | 8 | collectMetricOrder, |
11 | | - collectWorkspaceRunningCheckpoint, |
12 | | - collectWorkspaceRaceConditionData, |
13 | 9 | collectOverrideRevisionDetails |
14 | 10 | } from './collect' |
15 | 11 | import plotsDiffFixture from '../../test/fixtures/plotsDiff/output' |
16 | 12 | import expShowFixture from '../../test/fixtures/expShow/base/output' |
17 | 13 | import modifiedFixture from '../../test/fixtures/expShow/modified/output' |
18 | 14 | import checkpointPlotsFixture from '../../test/fixtures/expShow/base/checkpointPlots' |
19 | 15 | import { ExperimentsOutput, ExperimentStatus } from '../../cli/dvc/contract' |
20 | | -import { |
21 | | - definedAndNonEmpty, |
22 | | - sameContents, |
23 | | - uniqueValues |
24 | | -} from '../../util/array' |
| 16 | +import { definedAndNonEmpty, sameContents } from '../../util/array' |
25 | 17 | import { TemplatePlot } from '../webview/contract' |
26 | 18 | import { getCLIBranchId } from '../../test/fixtures/plotsDiff/util' |
27 | 19 | import { SelectedExperimentWithColor } from '../../experiments/model' |
@@ -83,34 +75,6 @@ describe('collectCheckpointPlotsData', () => { |
83 | 75 | }) |
84 | 76 | }) |
85 | 77 |
|
86 | | -describe('collectWorkspaceRunningCheckpoint', () => { |
87 | | - const fixtureCopy = cloneDeep(expShowFixture) |
88 | | - const runningCheckpointFixture: ExperimentsOutput = merge(fixtureCopy, { |
89 | | - '53c3851f46955fa3e2b8f6e1c52999acc8c9ea77': { |
90 | | - '4fb124aebddb2adf1545030907687fa9a4c80e70': { |
91 | | - data: { |
92 | | - executor: 'workspace' |
93 | | - } |
94 | | - } |
95 | | - } |
96 | | - }) |
97 | | - |
98 | | - it('should return the expected sha from the test fixture', () => { |
99 | | - const checkpointRunningInTheWorkspace = collectWorkspaceRunningCheckpoint( |
100 | | - runningCheckpointFixture, |
101 | | - true |
102 | | - ) |
103 | | - |
104 | | - expect(checkpointRunningInTheWorkspace).toStrictEqual('4fb124a') |
105 | | - }) |
106 | | - |
107 | | - it('should always return undefined when there are no checkpoints', () => { |
108 | | - expect( |
109 | | - collectWorkspaceRunningCheckpoint(runningCheckpointFixture, false) |
110 | | - ).toBeUndefined() |
111 | | - }) |
112 | | -}) |
113 | | - |
114 | 78 | describe('collectMetricOrder', () => { |
115 | 79 | it('should return an empty array if there is no checkpoints data', () => { |
116 | 80 | const metricOrder = collectMetricOrder( |
@@ -302,66 +266,6 @@ describe('collectTemplates', () => { |
302 | 266 | }) |
303 | 267 | }) |
304 | 268 |
|
305 | | -describe('collectWorkspaceRaceConditionData', () => { |
306 | | - const { comparisonData, revisionData } = collectData(plotsDiffFixture, { |
307 | | - '1ba7bcd': '1ba7bcd', |
308 | | - '42b8736': '42b8736', |
309 | | - '4fb124a': '4fb124a', |
310 | | - '53c3851': 'main', |
311 | | - workspace: 'workspace' |
312 | | - }) |
313 | | - |
314 | | - it('should return no overwrite data if there is no selected checkpoint experiment running in the workspace', () => { |
315 | | - const { overwriteComparisonData, overwriteRevisionData } = |
316 | | - collectWorkspaceRaceConditionData(undefined, comparisonData, revisionData) |
317 | | - expect(overwriteComparisonData).toStrictEqual({}) |
318 | | - expect(overwriteRevisionData).toStrictEqual({}) |
319 | | - }) |
320 | | - |
321 | | - it('should return no overwrite data if there is no data relating to the requested checkpoint', () => { |
322 | | - const { overwriteComparisonData, overwriteRevisionData } = |
323 | | - collectWorkspaceRaceConditionData('7c500fd', comparisonData, revisionData) |
324 | | - expect(overwriteComparisonData).toStrictEqual({}) |
325 | | - expect(overwriteRevisionData).toStrictEqual({}) |
326 | | - }) |
327 | | - |
328 | | - it('should return the appropriate overwrite data if the revision exists inside of the given data', () => { |
329 | | - const { overwriteComparisonData, overwriteRevisionData } = |
330 | | - collectWorkspaceRaceConditionData('4fb124a', comparisonData, revisionData) |
331 | | - |
332 | | - expect(overwriteComparisonData.workspace).toStrictEqual( |
333 | | - comparisonData['4fb124a'] |
334 | | - ) |
335 | | - |
336 | | - expect(overwriteRevisionData.workspace).not.toStrictEqual( |
337 | | - revisionData['4fb124a'] |
338 | | - ) |
339 | | - |
340 | | - const allWorkspaceValues = Object.values(overwriteRevisionData.workspace) |
341 | | - const allOverwriteValues = Object.values(revisionData['4fb124a']) |
342 | | - |
343 | | - expect(allWorkspaceValues.length).toBeTruthy() |
344 | | - expect(allWorkspaceValues).toHaveLength(allOverwriteValues.length) |
345 | | - |
346 | | - const allWorkspaceRevValues: string[] = [] |
347 | | - const allWorkspaceNonRevValues: Record<string, unknown>[] = [] |
348 | | - |
349 | | - for (const values of allWorkspaceValues) { |
350 | | - for (const { rev, ...rest } of values) { |
351 | | - allWorkspaceRevValues.push(rev as string) |
352 | | - allWorkspaceNonRevValues.push(rest) |
353 | | - } |
354 | | - } |
355 | | - |
356 | | - expect(uniqueValues(allWorkspaceRevValues)).toStrictEqual(['workspace']) |
357 | | - expect(allWorkspaceNonRevValues).toStrictEqual( |
358 | | - allOverwriteValues.flatMap(values => |
359 | | - values.map(value => omit(value, 'rev')) |
360 | | - ) |
361 | | - ) |
362 | | - }) |
363 | | -}) |
364 | | - |
365 | 269 | describe('collectOverrideRevisionDetails', () => { |
366 | 270 | it('should override the revision details for running checkpoint tips', () => { |
367 | 271 | const runningId = 'b' |
|
0 commit comments