-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature: making contextdir optional Signed-off-by: axel7083 <[email protected]> * fix: prettier Signed-off-by: axel7083 <[email protected]> * fix: linter Signed-off-by: axel7083 <[email protected]> * fix: comments Signed-off-by: axel7083 <[email protected]> * fix: remove getParentDirectory logic Signed-off-by: axel7083 <[email protected]> * fix: linter Signed-off-by: axel7083 <[email protected]> * fix: linter Signed-off-by: axel7083 <[email protected]> * fix: applicationManager mocks Signed-off-by: axel7083 <[email protected]> --------- Signed-off-by: axel7083 <[email protected]>
- Loading branch information
Showing
4 changed files
with
81 additions
and
18 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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { expect, test, describe, vi } from 'vitest'; | ||
import fs from 'fs'; | ||
import { type AIConfig, parseYamlFile } from './AIConfig'; | ||
|
||
// Define mock file paths and contents | ||
const mockYamlPath = '/path/to/mock.yml'; | ||
const mockYamlContent = ` | ||
application: | ||
containers: | ||
- name: container1 | ||
contextdir: /path/to/dir1 | ||
arch: ["x86"] | ||
model-service: true | ||
gpu-env: ["env1", "env2"] | ||
- name: container2 | ||
arch: ["arm"] | ||
`; | ||
|
||
const readFileSync = vi.spyOn(fs, 'readFileSync'); | ||
|
||
describe('parseYaml', () => { | ||
test('should parse valid YAML file', () => { | ||
readFileSync.mockReturnValue(mockYamlContent); | ||
|
||
const defaultArch = 'x64'; | ||
const expectedConfig: AIConfig = { | ||
application: { | ||
containers: [ | ||
{ | ||
name: 'container1', | ||
contextdir: '/path/to/dir1', | ||
arch: ['x86'], | ||
modelService: true, | ||
gpu_env: ['env1', 'env2'], | ||
}, | ||
{ | ||
name: 'container2', | ||
contextdir: '.', | ||
arch: ['arm'], | ||
modelService: false, | ||
gpu_env: [], | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
expect(parseYamlFile(mockYamlPath, defaultArch)).toEqual(expectedConfig); | ||
}); | ||
}); |
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