Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix issue on applehv when mounting volume (#130) #135

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions packages/backend/src/managers/applicationManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,3 +710,63 @@ describe('createApplicationPod', () => {
});
});
});
describe('createAndAddContainersToPod', () => {
const imageInfo1: ImageInfo = {
id: 'id',
appName: 'appName',
modelService: false,
ports: ['8080'],
};
const imageInfo2: ImageInfo = {
id: 'id2',
appName: 'appName2',
modelService: true,
ports: ['8082'],
};
const manager = new ApplicationManager(
'/home/user/aistudio',
{} as unknown as GitManager,
{} as unknown as RecipeStatusRegistry,
{} as unknown as ModelsManager,
);
const podInfo: PodInfo = {
engineId: 'engine',
Id: 'id',
};
test('check container is created with volume mounted if model service', async () => {
mocks.createContainerMock.mockResolvedValue(undefined);
await manager.createAndAddContainersToPod(podInfo, [imageInfo2], 'path/model.gguf');
expect(mocks.createContainerMock).toBeCalledWith('engine', {
Image: imageInfo2.id,
Detach: true,
HostConfig: {
AutoRemove: true,
Mounts: [
{
Target: `/model.gguf`,
Source: 'path/model.gguf',
Type: 'bind',
BindOptions: {
Propagation: 'z',
},
},
],
},
Env: [`MODEL_PATH=/model.gguf`],
start: false,
});
});
test('check MODEL_ENDPOINT env variable is set for non-model service container', async () => {
mocks.createContainerMock.mockResolvedValue(undefined);
await manager.createAndAddContainersToPod(podInfo, [imageInfo1, imageInfo2], 'path/model.gguf');
expect(mocks.createContainerMock).toHaveBeenNthCalledWith(1, 'engine', {
Image: imageInfo1.id,
Detach: true,
HostConfig: {
AutoRemove: true,
},
Env: [`MODEL_ENDPOINT=http://localhost:8082`],
start: false,
});
});
});
3 changes: 3 additions & 0 deletions packages/backend/src/managers/applicationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ export class ApplicationManager {
Target: `/${modelName}`,
Source: modelPath,
Type: 'bind',
BindOptions: {
Propagation: 'z',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not compatible with the Podman Desktop API

},
},
],
};
Expand Down
Loading