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(demand): fixed passing deprecated engine parameter #1088

Merged
merged 1 commit into from
Sep 24, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class WorkloadDemandDirectorConfig extends BaseConfig {

Object.assign(this, options);

if (!this.runtime.name) {
if (!options.runtime?.name) {
this.runtime.name = this.engine;
}

Expand Down
17 changes: 17 additions & 0 deletions src/market/demand/directors/workload-demand-director.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,21 @@ describe("ActivityDemandDirector", () => {
"The engine parameter is deprecated and cannot be used with the runtime parameter. Use the runtime option only",
);
});

test("should use deprecated engine param as runtime name", async () => {
const builder = new DemandBodyBuilder();

const director = new WorkloadDemandDirector(
new WorkloadDemandDirectorConfig({
engine: "vm-test",
expirationSec: 2,
imageHash: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
}),
);
await director.apply(builder);

const decorations = builder.getProduct();

expect(decorations.constraints).toEqual(expect.arrayContaining(["(golem.runtime.name=vm-test)"]));
});
});