From b1d65b706cddeb7e46f467d8af8ca78e98eef4fc Mon Sep 17 00:00:00 2001 From: DukeManh Date: Sun, 1 May 2022 19:01:26 -0400 Subject: [PATCH 1/3] Wait for SAML and postgres on CI --- .github/workflows/e2e-tests-ci.yml | 2 ++ src/api/sso/jest.config.e2e.js | 44 ++++++++---------------------- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/.github/workflows/e2e-tests-ci.yml b/.github/workflows/e2e-tests-ci.yml index d59fb0e8cf..4b342542a3 100644 --- a/.github/workflows/e2e-tests-ci.yml +++ b/.github/workflows/e2e-tests-ci.yml @@ -39,6 +39,8 @@ jobs: - run: pnpm install - name: Pull/Build Docker Containers Necessary for Running E2E Tests run: docker compose --env-file ./config/env.development up -d ${{ env.DOCKER_CONTAINERS }} + - name: Wait for Postgres and Login containers to become fully ready + run: pnpx -y wait-on -t 60000 tcp:5432 http://localhost:8081/simplesaml - name: Apply database migrations run: pnpm db:migrate - run: pnpm jest:e2e diff --git a/src/api/sso/jest.config.e2e.js b/src/api/sso/jest.config.e2e.js index 4e8f556b01..7edce0a4d9 100644 --- a/src/api/sso/jest.config.e2e.js +++ b/src/api/sso/jest.config.e2e.js @@ -1,34 +1,14 @@ -// eslint-disable-next-line -const { waitForPostgres } = require('@jcoreio/wait-for-postgres'); - const baseConfig = require('../../../jest.config.base'); -module.exports = async () => { - try { - console.log('Waiting for Supabase postgres container to become ready...'); - await waitForPostgres({ - host: 'localhost', - user: 'postgres', - password: process.env.POSTGRES_PASSWORD, - database: 'postgres', - timeout: 60 * 1000, - }); - } catch (err) { - console.warn('Unable to connect to postgres container'); - throw err; - } - - console.log('Supabase postgres container ready.'); - return { - ...baseConfig, - rootDir: '../../..', - testMatch: ['/src/api/sso/test/e2e/**/*.test.js'], - collectCoverageFrom: ['/src/api/sso/src/**/*.js'], - // We use jest-playwright to do browser tests, https://github.com/playwright-community/jest-playwright - // See the jest-playwright config in the Telescope root ./jest-playwright.config.js - preset: 'jest-playwright-preset', - // Try reducing the number of tests that can run at once down to 1 - maxConcurrency: 1, - maxWorkers: 1, - }; -}; +module.exports = () => ({ + ...baseConfig, + rootDir: '../../..', + testMatch: ['/src/api/sso/test/e2e/**/*.test.js'], + collectCoverageFrom: ['/src/api/sso/src/**/*.js'], + // We use jest-playwright to do browser tests, https://github.com/playwright-community/jest-playwright + // See the jest-playwright config in the Telescope root ./jest-playwright.config.js + preset: 'jest-playwright-preset', + // Try reducing the number of tests that can run at once down to 1 + maxConcurrency: 1, + maxWorkers: 1, +}); From caae71f2f84043c55162813fdc89b195588599d6 Mon Sep 17 00:00:00 2001 From: DukeManh Date: Sun, 1 May 2022 19:11:42 -0400 Subject: [PATCH 2/3] install eslint in feed-discovery --- pnpm-lock.yaml | 2 ++ src/api/feed-discovery/package.json | 1 + 2 files changed, 3 insertions(+) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0e2cda6981..bf9b6084b0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -103,6 +103,7 @@ importers: '@senecacdot/eslint-config-telescope': 1.1.0 '@senecacdot/satellite': ^1.27.0 cheerio: 1.0.0-rc.10 + eslint: 7.32.0 got: 11.8.3 nock: 13.2.4 nodemon: 2.0.15 @@ -113,6 +114,7 @@ importers: got: 11.8.3 devDependencies: '@senecacdot/eslint-config-telescope': 1.1.0_eslint@7.32.0 + eslint: 7.32.0 nock: 13.2.4 nodemon: 2.0.15 supertest: 6.1.6 diff --git a/src/api/feed-discovery/package.json b/src/api/feed-discovery/package.json index a42e351cd8..9bafac05c0 100644 --- a/src/api/feed-discovery/package.json +++ b/src/api/feed-discovery/package.json @@ -29,6 +29,7 @@ }, "devDependencies": { "@senecacdot/eslint-config-telescope": "1.1.0", + "eslint": "7.32.0", "nock": "13.2.4", "nodemon": "2.0.15", "supertest": "6.1.6" From 86f75a1622be06cfc93f75283585d7b6e6c38152 Mon Sep 17 00:00:00 2001 From: DukeManh Date: Sun, 1 May 2022 22:34:09 -0400 Subject: [PATCH 3/3] remove wait-for-postgres --- pnpm-lock.yaml | 117 ++------------------------------------- src/api/sso/package.json | 1 - 2 files changed, 4 insertions(+), 114 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bf9b6084b0..e0ddeeda3c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -252,7 +252,6 @@ importers: src/api/sso: specifiers: - '@jcoreio/wait-for-postgres': 2.0.0 '@senecacdot/eslint-config-telescope': 1.1.0 '@senecacdot/satellite': ^1.27.0 '@supabase/supabase-js': 1.29.4 @@ -280,7 +279,6 @@ importers: passport: 0.5.2 passport-saml: 3.2.1 devDependencies: - '@jcoreio/wait-for-postgres': 2.0.0 '@senecacdot/eslint-config-telescope': 1.1.0_eslint@7.32.0 env-cmd: 10.1.0 eslint: 7.32.0 @@ -4211,23 +4209,6 @@ packages: resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} engines: {node: '>=8'} - /@jcoreio/poll/2.3.1: - resolution: {integrity: sha512-NKtnakQBJVwu5//JgR2NIL1chYSEtiSXT4qj19Ia7CXqAG7WvzRSBa8nZtNyFwnNVMMP0UXz1g1JfLq1KYXBeA==} - dependencies: - '@babel/runtime': 7.17.2 - dev: true - - /@jcoreio/wait-for-postgres/2.0.0: - resolution: {integrity: sha512-GbBmn9Mo/3+KABREQcM7zaESilZH16ZHSPOV0c+34RLjxU0d04EzvmkN1mQrS88wLsj0ANCO3iGr7sAADdcquw==} - engines: {node: '>=8.0.0'} - dependencies: - '@jcoreio/poll': 2.3.1 - p-event: 4.2.0 - pg: 8.7.3 - transitivePeerDependencies: - - pg-native - dev: true - /@jest/console/27.5.1: resolution: {integrity: sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} @@ -8154,11 +8135,6 @@ packages: resolution: {integrity: sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==} dev: false - /buffer-writer/2.0.0: - resolution: {integrity: sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==} - engines: {node: '>=4'} - dev: true - /buffer/5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} dependencies: @@ -15127,16 +15103,10 @@ packages: engines: {node: '>=8'} dev: false - /p-event/4.2.0: - resolution: {integrity: sha512-KXatOjCRXXkSePPb1Nbi0p0m+gQAwdlbhi4wQKJPI1HsMQS9g+Sqp2o+QHziPr7eYJyOZet836KoHEVM1mwOrQ==} - engines: {node: '>=8'} - dependencies: - p-timeout: 3.2.0 - dev: true - /p-finally/1.0.0: resolution: {integrity: sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=} engines: {node: '>=4'} + dev: false /p-is-promise/3.0.0: resolution: {integrity: sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ==} @@ -15219,6 +15189,7 @@ packages: engines: {node: '>=8'} dependencies: p-finally: 1.0.0 + dev: false /p-try/1.0.0: resolution: {integrity: sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=} @@ -15278,10 +15249,6 @@ packages: registry-url: 5.1.0 semver: 6.3.0 - /packet-reader/1.0.0: - resolution: {integrity: sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==} - dev: true - /pako/0.2.9: resolution: {integrity: sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=} dev: false @@ -15507,62 +15474,6 @@ packages: resolution: {integrity: sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=} dev: false - /pg-connection-string/2.5.0: - resolution: {integrity: sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ==} - dev: true - - /pg-int8/1.0.1: - resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} - engines: {node: '>=4.0.0'} - dev: true - - /pg-pool/3.5.1_pg@8.7.3: - resolution: {integrity: sha512-6iCR0wVrro6OOHFsyavV+i6KYL4lVNyYAB9RD18w66xSzN+d8b66HiwuP30Gp1SH5O9T82fckkzsRjlrhD0ioQ==} - peerDependencies: - pg: '>=8.0' - dependencies: - pg: 8.7.3 - dev: true - - /pg-protocol/1.5.0: - resolution: {integrity: sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ==} - dev: true - - /pg-types/2.2.0: - resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} - engines: {node: '>=4'} - dependencies: - pg-int8: 1.0.1 - postgres-array: 2.0.0 - postgres-bytea: 1.0.0 - postgres-date: 1.0.7 - postgres-interval: 1.2.0 - dev: true - - /pg/8.7.3: - resolution: {integrity: sha512-HPmH4GH4H3AOprDJOazoIcpI49XFsHCe8xlrjHkWiapdbHK+HLtbm/GQzXYAZwmPju/kzKhjaSfMACG+8cgJcw==} - engines: {node: '>= 8.0.0'} - peerDependencies: - pg-native: '>=2.0.0' - peerDependenciesMeta: - pg-native: - optional: true - dependencies: - buffer-writer: 2.0.0 - packet-reader: 1.0.0 - pg-connection-string: 2.5.0 - pg-pool: 3.5.1_pg@8.7.3 - pg-protocol: 1.5.0 - pg-types: 2.2.0 - pgpass: 1.0.5 - dev: true - - /pgpass/1.0.5: - resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==} - dependencies: - split2: 4.1.0 - dev: true - /picocolors/1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} @@ -16301,28 +16212,6 @@ packages: source-map-js: 1.0.2 dev: false - /postgres-array/2.0.0: - resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} - engines: {node: '>=4'} - dev: true - - /postgres-bytea/1.0.0: - resolution: {integrity: sha1-AntTPAqokOJtFy1Hz5zOzFIazTU=} - engines: {node: '>=0.10.0'} - dev: true - - /postgres-date/1.0.7: - resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} - engines: {node: '>=0.10.0'} - dev: true - - /postgres-interval/1.2.0: - resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} - engines: {node: '>=0.10.0'} - dependencies: - xtend: 4.0.2 - dev: true - /posthtml-parser/0.10.2: resolution: {integrity: sha512-PId6zZ/2lyJi9LiKfe+i2xv57oEjJgWbsHGGANwos5AvdQp98i6AtamAl8gzSVFGfQ43Glb5D614cvZf012VKg==} engines: {node: '>=12'} @@ -18122,6 +18011,7 @@ packages: /split2/4.1.0: resolution: {integrity: sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ==} engines: {node: '>= 10.x'} + dev: false /sprintf-js/1.0.3: resolution: {integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=} @@ -20280,6 +20170,7 @@ packages: /xtend/4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} + dev: false /xterm-addon-fit/0.5.0_xterm@4.18.0: resolution: {integrity: sha512-DsS9fqhXHacEmsPxBJZvfj2la30Iz9xk+UKjhQgnYNkrUIN5CYLbw7WEfz117c7+S86S/tpHPfvNxJsF5/G8wQ==} diff --git a/src/api/sso/package.json b/src/api/sso/package.json index b74b42fbe6..5a2589bbf0 100644 --- a/src/api/sso/package.json +++ b/src/api/sso/package.json @@ -35,7 +35,6 @@ "node": ">=12.0.0" }, "devDependencies": { - "@jcoreio/wait-for-postgres": "2.0.0", "@senecacdot/eslint-config-telescope": "1.1.0", "env-cmd": "10.1.0", "eslint": "7.32.0",