-
-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: add more docker tests * chore: revert mocharc change * chore: remove DS_Store * test: remove unsupported nodejs 21 * ci: change architecture for docker tests * ci: use azul instead of temurin * ci: use zulu openjdk * ci: use macos-12
- Loading branch information
1 parent
d6b155e
commit cdec7bd
Showing
28 changed files
with
521 additions
and
216 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
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
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
Oops, something went wrong.