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

409 run tests against docker container #410

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,18 @@ jobs:
DEBUG: openapi-cop:*
CI: true

- if: startsWith(matrix.node-version, '12')
name: Test Docker image
run: npm run test:docker
env:
DEBUG: openapi-cop:*
CI: true

- name: Dump docker logs on failure
if: failure() && startsWith(matrix.node-version, '12')
uses: jwalton/gh-docker-logs@v2
with:
images: 'lxlu/openapi-cop:test'

- name: Analyze dependencies
run: npm run test:deps
11 changes: 11 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"bail": true,
"timeout": 60000,
"exit": true,
"spec": [
"build/test/*.test.js"
],
"require": [
"dotenv/config"
]
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10
12
9 changes: 5 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
FROM node:10 AS builder
FROM node:12 AS builder
WORKDIR /app
COPY . .
RUN npm ci --unsafe-perm
RUN npm ci --no-optional --unsafe-perm
RUN npm run compile

FROM node:10 AS main
FROM node:12 AS main

ENV TARGET ""
ENV FILE ""
ENV DEFAULT_FORBID_ADDITIONAL_PROPERTIES ""
ENV SILENT ""
ENV VERBOSE ""
ENV CLI_ARGUMENTS ""
ENV NODE_ENV "production"

WORKDIR /openapi-cop-docker
COPY package.json .
COPY package-lock.json .
RUN npm ci --omit=dev
RUN npm ci --omit=dev --no-optional
COPY --from=builder /app/build .
COPY docker/entrypoint.bash .

Expand Down
1 change: 1 addition & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ same [openapi-cop CLI flags](https://github.com/EXXETA/openapi-cop#cli-usage):
are not allowed.
- `SILENT`: When set, the proxy will forward response bodies unchanged and only set validation headers.
- `VERBOSE`: When set, activates verbose output.
- `CLI_ARGUMENTS`: Sets all the arguments at once and overrides any other option given.
- `NODE_ENV` (default: "production"): When set to "development", stack traces will also be logged.

### Example
Expand Down
4 changes: 4 additions & 0 deletions docker/entrypoint.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ if [ -n "$VERBOSE" ]; then
cli_args="${cli_args}--verbose "
fi

if [ -n "$CLI_ARGUMENTS" ]; then
cli_args="$CLI_ARGUMENTS"
fi

node src/cli --host 0.0.0.0 $cli_args
2 changes: 0 additions & 2 deletions mock-server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ export async function runApp({ port, apiDocFile }: MockOptions): Promise<http.Se
server = app.listen(port, () => {
resolve(server);
});
}).then(() => {
return server;
});
} catch (error) {
console.error('Failed to run mock server', error);
Expand Down
10 changes: 0 additions & 10 deletions mock-server/tslint.json

This file was deleted.

Loading