-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-show-options
- Loading branch information
Showing
11 changed files
with
154 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import { Flag, GcPreserveFlag } from './constants' | |
import { DvcExecutor } from './executor' | ||
import { CliResult, CliStarted } from '..' | ||
import { createProcess } from '../../process/execution' | ||
import { getMockedProcess } from '../../test/util/jest' | ||
import { flushPromises, getMockedProcess } from '../../test/util/jest' | ||
import { getProcessEnv } from '../../env' | ||
import { Config } from '../../config' | ||
import { ContextKey, setContextValue } from '../../vscode/context' | ||
|
@@ -28,6 +28,9 @@ const mockedEnv = { | |
|
||
const mockedSetContextValue = jest.mocked(setContextValue) | ||
|
||
const mockedGetStudioLiveShareToken = jest.fn() | ||
const mockedGetRepoUrl = jest.fn() | ||
|
||
beforeEach(() => { | ||
jest.resetAllMocks() | ||
mockedGetProcessEnv.mockReturnValueOnce(mockedEnv) | ||
|
@@ -48,6 +51,8 @@ describe('CliExecutor', () => { | |
getCliPath: () => undefined, | ||
getPythonBinPath: () => undefined | ||
} as unknown as Config, | ||
mockedGetStudioLiveShareToken, | ||
mockedGetRepoUrl, | ||
{ | ||
processCompleted: { | ||
event: jest.fn(), | ||
|
@@ -602,6 +607,39 @@ describe('CliExecutor', () => { | |
executable: 'dvc' | ||
}) | ||
}) | ||
|
||
it("should call createProcess with the correct parameters to start the experiment's queue and send live updates to Studio", async () => { | ||
const cwd = __dirname | ||
const jobs = '91231324' | ||
const mockedToken = 'isat_notarealtoken' | ||
const mockedUrl = '[email protected]:iterative/vscode-dvc-demo.git' | ||
|
||
mockedGetStudioLiveShareToken.mockReturnValueOnce(mockedToken) | ||
mockedGetRepoUrl.mockResolvedValueOnce( | ||
'[email protected]:iterative/vscode-dvc-demo.git' | ||
) | ||
|
||
const stdout = `Started '${jobs}' new experiments task queue workers.` | ||
|
||
mockedCreateProcess.mockReturnValueOnce(getMockedProcess(stdout)) | ||
|
||
void dvcExecutor.queueStart(cwd, jobs) | ||
await flushPromises() | ||
|
||
expect(mockedGetRepoUrl).toHaveBeenCalledWith(cwd) | ||
|
||
expect(mockedCreateProcess).toHaveBeenCalledWith({ | ||
args: ['queue', 'start', '-j', jobs], | ||
cwd, | ||
detached: true, | ||
env: { | ||
...mockedEnv, | ||
STUDIO_REPO_URL: mockedUrl, | ||
STUDIO_TOKEN: mockedToken | ||
}, | ||
executable: 'dvc' | ||
}) | ||
}) | ||
}) | ||
|
||
describe('queueStop', () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,9 +76,7 @@ | |
"loader-utils": "2.0.4", | ||
"terser": "5.16.5", | ||
"trim-newlines": "3.0.1", | ||
"trim": "1.0.1", | ||
"vega-functions": "5.13.0", | ||
"vega-scale": "7.2.0" | ||
"trim": "1.0.1" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters