From e8d7fe41112308f3a55d452cfcddbb92eaa5376b Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Sat, 2 Mar 2019 23:16:53 +0100 Subject: [PATCH] Move users_database.yml files to dedicated suites. --- .npmignore | 2 -- test/suites/.gitignore | 1 + test/suites/basic/config.yml | 2 +- test/suites/basic/environment.ts | 1 + test/suites/basic/test.ts | 3 ++- users_database.yml => test/suites/basic/users_database.yml | 0 test/suites/short-timeouts/config.yml | 2 +- test/suites/short-timeouts/environment.ts | 1 + test/suites/short-timeouts/test.ts | 5 ----- .../suites/short-timeouts/users_database.yml | 0 10 files changed, 7 insertions(+), 10 deletions(-) create mode 100644 test/suites/.gitignore rename users_database.yml => test/suites/basic/users_database.yml (100%) rename users_database.example.yml => test/suites/short-timeouts/users_database.yml (100%) diff --git a/.npmignore b/.npmignore index 5248d7d1b..93304db63 100644 --- a/.npmignore +++ b/.npmignore @@ -8,13 +8,11 @@ images/ example/ .travis.yml -config.test.yml CONTRIBUTORS.md Dockerfile docker-compose.* Gruntfile.js tslint.json tsconfig.json -users_database.yml *.tgz diff --git a/test/suites/.gitignore b/test/suites/.gitignore new file mode 100644 index 000000000..4df2d1dca --- /dev/null +++ b/test/suites/.gitignore @@ -0,0 +1 @@ +users_database.test.yml \ No newline at end of file diff --git a/test/suites/basic/config.yml b/test/suites/basic/config.yml index 6fa30b143..7ac889061 100644 --- a/test/suites/basic/config.yml +++ b/test/suites/basic/config.yml @@ -10,7 +10,7 @@ default_redirection_url: https://home.example.com:8080/ authentication_backend: file: - path: ./users_database.yml + path: ./test/suites/basic/users_database.test.yml session: secret: unsecure_session_secret diff --git a/test/suites/basic/environment.ts b/test/suites/basic/environment.ts index 82fd6611a..6d865c6a9 100644 --- a/test/suites/basic/environment.ts +++ b/test/suites/basic/environment.ts @@ -12,6 +12,7 @@ const dockerEnv = new DockerEnvironment([ ]) async function setup() { + await exec(`cp ${__dirname}/users_database.yml ${__dirname}/users_database.test.yml`); await exec('mkdir -p /tmp/authelia/db'); await exec('./example/compose/nginx/portal/render.js ' + (fs.existsSync('.suite') ? '': '--production')); await dockerEnv.start(); diff --git a/test/suites/basic/test.ts b/test/suites/basic/test.ts index 00d9c177f..0a1e6a36b 100644 --- a/test/suites/basic/test.ts +++ b/test/suites/basic/test.ts @@ -12,8 +12,9 @@ import { exec } from '../../helpers/utils/exec'; AutheliaSuite('Simple configuration', __dirname, function() { this.timeout(10000); + beforeEach(async function() { - await exec('cp users_database.example.yml users_database.yml'); + await exec(`cp ${__dirname}/users_database.yml ${__dirname}/users_database.test.yml`); }); describe('Simple authentication', SimpleAuthentication); diff --git a/users_database.yml b/test/suites/basic/users_database.yml similarity index 100% rename from users_database.yml rename to test/suites/basic/users_database.yml diff --git a/test/suites/short-timeouts/config.yml b/test/suites/short-timeouts/config.yml index 7920a4094..992f5b903 100644 --- a/test/suites/short-timeouts/config.yml +++ b/test/suites/short-timeouts/config.yml @@ -10,7 +10,7 @@ default_redirection_url: https://home.example.com:8080/ authentication_backend: file: - path: ./users_database.yml + path: ./test/suites/short-timeouts/users_database.test.yml session: secret: unsecure_session_secret diff --git a/test/suites/short-timeouts/environment.ts b/test/suites/short-timeouts/environment.ts index 82fd6611a..6d865c6a9 100644 --- a/test/suites/short-timeouts/environment.ts +++ b/test/suites/short-timeouts/environment.ts @@ -12,6 +12,7 @@ const dockerEnv = new DockerEnvironment([ ]) async function setup() { + await exec(`cp ${__dirname}/users_database.yml ${__dirname}/users_database.test.yml`); await exec('mkdir -p /tmp/authelia/db'); await exec('./example/compose/nginx/portal/render.js ' + (fs.existsSync('.suite') ? '': '--production')); await dockerEnv.start(); diff --git a/test/suites/short-timeouts/test.ts b/test/suites/short-timeouts/test.ts index e5ccc5bba..e47eadc5e 100644 --- a/test/suites/short-timeouts/test.ts +++ b/test/suites/short-timeouts/test.ts @@ -1,12 +1,7 @@ import AutheliaSuite from "../../helpers/context/AutheliaSuite"; import Inactivity from './scenarii/Inactivity'; -import { exec } from '../../helpers/utils/exec'; AutheliaSuite('Short timeouts', __dirname, function() { this.timeout(10000); - beforeEach(async function() { - await exec('cp users_database.example.yml users_database.yml'); - }); - describe('Inactivity period', Inactivity); }); \ No newline at end of file diff --git a/users_database.example.yml b/test/suites/short-timeouts/users_database.yml similarity index 100% rename from users_database.example.yml rename to test/suites/short-timeouts/users_database.yml