Skip to content

Commit b933352

Browse files
authored
test: Remove engine v1 options (#100)
1 parent 64031a6 commit b933352

File tree

1 file changed

+59
-82
lines changed

1 file changed

+59
-82
lines changed

test/integration/v2/engine.test.ts

Lines changed: 59 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,23 @@ import {
33
Firebolt,
44
FireboltResourceManager
55
} from "../../../src/index";
6-
import {
7-
CreateEngineOptions,
8-
EngineType,
9-
WarmupMethod
10-
} from "../../../src/service/engine/types";
6+
import { CreateEngineOptions } from "../../../src/service/engine/types";
117

128
const authOptions = {
139
client_id: process.env.FIREBOLT_CLIENT_ID as string,
1410
client_secret: process.env.FIREBOLT_CLIENT_SECRET as string
1511
};
1612

17-
const connectionOptionsV1 = {
18-
auth: authOptions,
19-
account: process.env.FIREBOLT_ACCOUNT_V1 as string
20-
};
21-
2213
const connectionOptionsV2 = {
2314
auth: authOptions,
2415
account: process.env.FIREBOLT_ACCOUNT_V2 as string
2516
};
2617

27-
const createDatabaseOptionsV1 = {
28-
description: "test description",
29-
fail_if_exists: false,
30-
region: "us-east-1"
31-
};
32-
3318
const createDatabaseOptionsV2 = {
3419
description: "test description",
3520
failIfExists: false
3621
};
3722

38-
const createEngineOptionsV1 = {
39-
region: "us-east-1",
40-
engine_type: EngineType.GENERAL_PURPOSE,
41-
spec: "B2",
42-
scale: 1,
43-
auto_stop: 20 * 60,
44-
warmup: WarmupMethod.MINIMAL,
45-
fail_if_exists: true
46-
};
47-
4823
const createEngineOptionsV2 = {
4924
spec: "S",
5025
scale: 1,
@@ -55,7 +30,6 @@ const createEngineOptionsV2 = {
5530
jest.setTimeout(60000);
5631

5732
describe.each([
58-
["v1", connectionOptionsV1, createDatabaseOptionsV1, createEngineOptionsV1],
5933
["v2", connectionOptionsV2, createDatabaseOptionsV2, createEngineOptionsV2]
6034
])(
6135
"engine integration for account %s",
@@ -173,67 +147,70 @@ describe.each([
173147
}
174148
);
175149

176-
describe.each([
177-
["v1", connectionOptionsV1],
178-
["v2", connectionOptionsV2]
179-
])("engine resource manager (account %s)", (account, connectionOptions) => {
180-
it("retrieves all engines", async () => {
181-
const firebolt = Firebolt({
182-
apiEndpoint: process.env.FIREBOLT_API_ENDPOINT as string
183-
});
184-
185-
await firebolt.connect(connectionOptions);
186-
187-
const engine_name = (process.env.FIREBOLT_ENGINE_NAME as string) + "_list";
188-
try {
189-
const options: CreateEngineOptions = {
190-
fail_if_exists: false
191-
};
192-
if (account === "v2") {
193-
options.initially_stopped = true;
194-
}
195-
await firebolt.resourceManager.engine.create(engine_name, options);
150+
describe.each([["v2", connectionOptionsV2]])(
151+
"engine resource manager (account %s)",
152+
(account, connectionOptions) => {
153+
it("retrieves all engines", async () => {
154+
const firebolt = Firebolt({
155+
apiEndpoint: process.env.FIREBOLT_API_ENDPOINT as string
156+
});
196157

197-
const engines = await firebolt.resourceManager.engine.getAll();
158+
await firebolt.connect(connectionOptions);
198159

199-
expect(engines.find(engine => engine_name === engine.name)).toBeTruthy();
200-
} finally {
160+
const engine_name =
161+
(process.env.FIREBOLT_ENGINE_NAME as string) + "_list";
201162
try {
202-
const engine = await firebolt.resourceManager.engine.getByName(
203-
engine_name
204-
);
205-
await engine?.stop();
206-
await engine?.delete();
207-
} catch {
208-
//ignore
163+
const options: CreateEngineOptions = {
164+
fail_if_exists: false
165+
};
166+
if (account === "v2") {
167+
options.initially_stopped = true;
168+
}
169+
await firebolt.resourceManager.engine.create(engine_name, options);
170+
171+
const engines = await firebolt.resourceManager.engine.getAll();
172+
173+
expect(
174+
engines.find(engine => engine_name === engine.name)
175+
).toBeTruthy();
176+
} finally {
177+
try {
178+
const engine = await firebolt.resourceManager.engine.getByName(
179+
engine_name
180+
);
181+
await engine?.stop();
182+
await engine?.delete();
183+
} catch {
184+
//ignore
185+
}
209186
}
210-
}
211-
});
212-
213-
it("use separate firebolt resource client", async () => {
214-
const firebolt = Firebolt({
215-
apiEndpoint: process.env.FIREBOLT_API_ENDPOINT as string
216187
});
217-
const connection = await firebolt.connect(connectionOptions);
218-
const resourceManager = FireboltResourceManager({
219-
connection
220-
});
221-
const engine_name =
222-
(process.env.FIREBOLT_ENGINE_NAME as string) + "_getByName";
223-
try {
224-
await resourceManager.engine.create(engine_name, {
225-
fail_if_exists: false
188+
189+
it("use separate firebolt resource client", async () => {
190+
const firebolt = Firebolt({
191+
apiEndpoint: process.env.FIREBOLT_API_ENDPOINT as string
192+
});
193+
const connection = await firebolt.connect(connectionOptions);
194+
const resourceManager = FireboltResourceManager({
195+
connection
226196
});
227-
const engine = await resourceManager.engine.getByName(engine_name);
228-
expect(engine.name).toEqual(engine_name);
229-
} finally {
197+
const engine_name =
198+
(process.env.FIREBOLT_ENGINE_NAME as string) + "_getByName";
230199
try {
200+
await resourceManager.engine.create(engine_name, {
201+
fail_if_exists: false
202+
});
231203
const engine = await resourceManager.engine.getByName(engine_name);
232-
await engine?.stop();
233-
await engine?.delete();
234-
} catch {
235-
//ignore
204+
expect(engine.name).toEqual(engine_name);
205+
} finally {
206+
try {
207+
const engine = await resourceManager.engine.getByName(engine_name);
208+
await engine?.stop();
209+
await engine?.delete();
210+
} catch {
211+
//ignore
212+
}
236213
}
237-
}
238-
});
239-
});
214+
});
215+
}
216+
);

0 commit comments

Comments
 (0)