Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6b155e
commit 999fa8f
Showing
30 changed files
with
599 additions
and
211 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
Binary file not shown.
101 changes: 49 additions & 52 deletions
101
tests/integration/docker/access-host/accessHost.test.js
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 |
---|---|---|
@@ -1,55 +1,52 @@ | ||
// import assert from 'node:assert' | ||
// import { env } from 'node:process' | ||
// import { Server } from '@hapi/hapi' | ||
// import { join } from 'desm' | ||
// import { setup, teardown } from '../../../_testHelpers/index.js' | ||
// import installNpmModules from '../../../installNpmModules.js' | ||
// import { BASE_URL } from '../../../config.js' | ||
import assert from "node:assert" | ||
import { env } from "node:process" | ||
import { Server } from "@hapi/hapi" | ||
import { join } from "desm" | ||
import { setup, teardown } from "../../../_testHelpers/index.js" | ||
import installNpmModules from "../../../installNpmModules.js" | ||
import { BASE_URL } from "../../../config.js" | ||
|
||
describe("Access host with Docker tests", function desc() { | ||
it("placeholder, node.js v12 not supported anymore", () => true) | ||
|
||
// let server | ||
// beforeEach(async () => { | ||
// await installNpmModules(join(import.meta.url, 'src')) | ||
// }) | ||
// beforeEach(async () => { | ||
// server = new Server({ port: 8080 }) | ||
// server.route({ | ||
// handler() { | ||
// return 'Hello Node.js!' | ||
// }, | ||
// method: 'GET', | ||
// path: '/hello', | ||
// }) | ||
// await server.start() | ||
// await setup({ | ||
// servicePath: join(import.meta.url), | ||
// }) | ||
// }) | ||
// afterEach(async () => { | ||
// await server.stop() | ||
// await teardown() | ||
// }) | ||
// // | ||
// ;[ | ||
// { | ||
// description: 'should access host in docker container', | ||
// expected: { | ||
// message: 'Hello Node.js!', | ||
// }, | ||
// path: '/dev/hello', | ||
// }, | ||
// ].forEach(({ description, expected, path }) => { | ||
// it(description, async function it() { | ||
// // "Could not find 'Docker', skipping tests." | ||
// if (!env.DOCKER_DETECTED) { | ||
// this.skip() | ||
// } | ||
// const url = new URL(path, BASE_URL) | ||
// const response = await fetch(url) | ||
// const json = await response.json() | ||
// assert.deepEqual(json, expected) | ||
// }) | ||
// }) | ||
let server | ||
beforeEach(async () => { | ||
await installNpmModules(join(import.meta.url, "src")) | ||
}) | ||
beforeEach(async () => { | ||
server = new Server({ port: 8080 }) | ||
server.route({ | ||
handler() { | ||
return "Hello Node.js!" | ||
}, | ||
method: "GET", | ||
path: "/hello", | ||
}) | ||
await server.start() | ||
await setup({ | ||
servicePath: join(import.meta.url), | ||
}) | ||
}) | ||
afterEach(async () => { | ||
await server.stop() | ||
await teardown() | ||
}) | ||
;[ | ||
{ | ||
description: "should access host in docker container", | ||
expected: { | ||
message: "Hello Node.js!", | ||
}, | ||
path: "/dev/hello", | ||
}, | ||
].forEach(({ description, expected, path }) => { | ||
it(description, async function it() { | ||
// "Could not find 'Docker', skipping tests." | ||
if (!env.DOCKER_DETECTED) { | ||
this.skip() | ||
} | ||
const url = new URL(path, BASE_URL) | ||
const response = await fetch(url) | ||
const json = await response.json() | ||
assert.deepEqual(json, expected) | ||
}) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -1,48 +1,44 @@ | ||
// import assert from 'node:assert' | ||
// import { env } from 'node:process' | ||
// import { join } from 'desm' | ||
// import { | ||
// compressArtifact, | ||
// setup, | ||
// teardown, | ||
// } from '../../../_testHelpers/index.js' | ||
// import { BASE_URL } from '../../../config.js' | ||
import assert from "node:assert" | ||
import { env } from "node:process" | ||
import { join } from "desm" | ||
import { | ||
compressArtifact, | ||
setup, | ||
teardown, | ||
} from "../../../_testHelpers/index.js" | ||
import { BASE_URL } from "../../../config.js" | ||
|
||
describe("Artifact with docker tests", function desc() { | ||
it("placeholder, node.js v12 not supported anymore", () => true) | ||
beforeEach(async () => { | ||
await compressArtifact(join(import.meta.url), "artifacts/hello.zip", [ | ||
"handler.js", | ||
]) | ||
return setup({ | ||
servicePath: join(import.meta.url), | ||
}) | ||
}) | ||
|
||
// beforeEach(async () => { | ||
// await compressArtifact(join(import.meta.url), 'artifacts/hello.zip', [ | ||
// 'handler.js', | ||
// ]) | ||
// return setup({ | ||
// servicePath: join(import.meta.url), | ||
// }) | ||
// }) | ||
afterEach(() => teardown()) | ||
;[ | ||
{ | ||
description: "should work with artifact in docker container", | ||
expected: { | ||
message: "Hello Node.js!", | ||
}, | ||
path: "/dev/hello", | ||
}, | ||
].forEach(({ description, expected, path }) => { | ||
it(description, async function it() { | ||
// "Could not find 'Docker', skipping tests." | ||
if (!env.DOCKER_DETECTED) { | ||
this.skip() | ||
} | ||
|
||
// afterEach(() => teardown()) | ||
const url = new URL(path, BASE_URL) | ||
const response = await fetch(url) | ||
const json = await response.json() | ||
|
||
// // | ||
// ;[ | ||
// { | ||
// description: 'should work with artifact in docker container', | ||
// expected: { | ||
// message: 'Hello Node.js!', | ||
// }, | ||
// path: '/dev/hello', | ||
// }, | ||
// ].forEach(({ description, expected, path }) => { | ||
// it(description, async function it() { | ||
// // "Could not find 'Docker', skipping tests." | ||
// if (!env.DOCKER_DETECTED) { | ||
// this.skip() | ||
// } | ||
|
||
// const url = new URL(path, BASE_URL) | ||
// const response = await fetch(url) | ||
// const json = await response.json() | ||
|
||
// assert.deepEqual(json, expected) | ||
// }) | ||
// }) | ||
assert.deepEqual(json, expected) | ||
}) | ||
}) | ||
}) |
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
120 changes: 58 additions & 62 deletions
120
tests/integration/docker/multiple/dockerMultiple.test.js
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 |
---|---|---|
@@ -1,65 +1,61 @@ | ||
// import assert from 'node:assert' | ||
// import { env } from 'node:process' | ||
// import { join } from 'desm' | ||
// import { setup, teardown } from '../../../_testHelpers/index.js' | ||
// import { BASE_URL } from '../../../config.js' | ||
import assert from "node:assert" | ||
import { env } from "node:process" | ||
import { join } from "desm" | ||
import { setup, teardown } from "../../../_testHelpers/index.js" | ||
import { BASE_URL } from "../../../config.js" | ||
|
||
describe("Multiple docker containers", function desc() { | ||
it("placeholder, node.js v12 not supported anymore", () => true) | ||
|
||
// beforeEach(() => | ||
// setup({ | ||
// servicePath: join(import.meta.url), | ||
// }), | ||
// ) | ||
|
||
// afterEach(() => teardown()) | ||
|
||
// // | ||
// ;[ | ||
// { | ||
// description: 'should work with multiple mixed docker containers', | ||
// expected1: { | ||
// message: 'Hello Node.js!', | ||
// }, | ||
// expected2: { | ||
// message: 'Hello Node.js!', | ||
// }, | ||
// expected3: { | ||
// message: 'Hello Python!', | ||
// }, | ||
// path1: '/dev/hello1', | ||
// path2: '/dev/hello2', | ||
// path3: '/dev/hello3', | ||
// }, | ||
// ].forEach( | ||
// ({ description, expected1, expected2, expected3, path1, path2, path3 }) => { | ||
// it(description, async function it() { | ||
// // "Could not find 'Docker', skipping tests." | ||
// if (!env.DOCKER_DETECTED) { | ||
// this.skip() | ||
// } | ||
|
||
// const url1 = new URL(path1, BASE_URL) | ||
// const url2 = new URL(path2, BASE_URL) | ||
// const url3 = new URL(path3, BASE_URL) | ||
|
||
// const [response1, response2, response3] = await Promise.all([ | ||
// fetch(url1), | ||
// fetch(url2), | ||
// fetch(url3), | ||
// ]) | ||
|
||
// const [json1, json2, json3] = await Promise.all([ | ||
// response1.json(), | ||
// response2.json(), | ||
// response3.json(), | ||
// ]) | ||
|
||
// assert.equal(json1.message, expected1.message) | ||
// assert.equal(json2.message, expected2.message) | ||
// assert.equal(json3.message, expected3.message) | ||
// }) | ||
// }, | ||
// ) | ||
beforeEach(() => | ||
setup({ | ||
servicePath: join(import.meta.url), | ||
}), | ||
) | ||
|
||
afterEach(() => teardown()) | ||
;[ | ||
{ | ||
description: "should work with multiple mixed docker containers", | ||
expected1: { | ||
message: "Hello Node.js!", | ||
}, | ||
expected2: { | ||
message: "Hello Node.js!", | ||
}, | ||
expected3: { | ||
message: "Hello Python!", | ||
}, | ||
path1: "/dev/hello1", | ||
path2: "/dev/hello2", | ||
path3: "/dev/hello3", | ||
}, | ||
].forEach( | ||
({ description, expected1, expected2, expected3, path1, path2, path3 }) => { | ||
it(description, async function it() { | ||
// "Could not find 'Docker', skipping tests." | ||
if (!env.DOCKER_DETECTED) { | ||
this.skip() | ||
} | ||
|
||
const url1 = new URL(path1, BASE_URL) | ||
const url2 = new URL(path2, BASE_URL) | ||
const url3 = new URL(path3, BASE_URL) | ||
|
||
const [response1, response2, response3] = await Promise.all([ | ||
fetch(url1), | ||
fetch(url2), | ||
fetch(url3), | ||
]) | ||
|
||
const [json1, json2, json3] = await Promise.all([ | ||
response1.json(), | ||
response2.json(), | ||
response3.json(), | ||
]) | ||
|
||
assert.equal(json1.message, expected1.message) | ||
assert.equal(json2.message, expected2.message) | ||
assert.equal(json3.message, expected3.message) | ||
}) | ||
}, | ||
) | ||
}) |
Oops, something went wrong.