Skip to content

Wait on SAML login to be ready#3569

Merged
DukeManh merged 3 commits into
Seneca-CDOT:masterfrom
DukeManh:wait-on-saml
May 2, 2022
Merged

Wait on SAML login to be ready#3569
DukeManh merged 3 commits into
Seneca-CDOT:masterfrom
DukeManh:wait-on-saml

Conversation

@DukeManh

@DukeManh DukeManh commented Apr 29, 2022

Copy link
Copy Markdown
Contributor

Wait for login container to be ready
.
Fix #3504

I can reproduce this e2e test failure consistently locally by running the e2e test right after spinning up the containers. So one of the containers must be not ready and make the test fail.

In #3504, following my suggestion, @humphd has tried to debug the test-web-container but found nothing suspicious.
I now realized it's the login or test-saml container that's not ready for tests.
I couldn't figure out why it takes so long to start up. The repo of the container itself has not been maintained for 4 years https://github.com/kristophjunge/docker-test-saml-idp.
For now, we can wait for the container to be ready before running tests.

Here's the log of the container.

 
[Fri Apr 29 02:44:36.458976 2022] [ssl:warn] [pid 1] AH01906: localhost:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
 
[Fri Apr 29 02:44:36.459226 2022] [ssl:warn] [pid 1] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
 
[Fri Apr 29 02:44:36.623171 2022] [ssl:warn] [pid 1] AH01906: localhost:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
 
[Fri Apr 29 02:44:36.623202 2022] [ssl:warn] [pid 1] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
 
[Fri Apr 29 02:44:36.678412 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/7.1.13 OpenSSL/1.0.1t configured -- resuming normal operations
 
[Fri Apr 29 02:44:36.678487 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
 
[Fri Apr 29 02:44:39.781121 2022] [php7:notice] [pid 17] [client 172.18.0.1:56276] simplesamlphp DEBUG [ab6d3b55bc] Session: 'admin' not valid because we are not authenticated.
 
[Fri Apr 29 02:44:39.781410 2022] [php7:notice] [pid 17] [client 172.18.0.1:56276] simplesamlphp DEBUG [ab6d3b55bc] Session: 'login-admin' not valid because we are not authenticated.
 
[Fri Apr 29 02:44:39.793346 2022] [php7:notice] [pid 17] [client 172.18.0.1:56276] simplesamlphp DEBUG [ab6d3b55bc] Localization: using old system
 
[Fri Apr 29 02:44:39.797445 2022] [php7:notice] [pid 17] [client 172.18.0.1:56276] simplesamlphp DEBUG [ab6d3b55bc] Template: Reading [/var/www/simplesamlphp/modules/core/dictionaries/frontpage]
 
[Fri Apr 29 02:44:39.803095 2022] [php7:notice] [pid 17] [client 172.18.0.1:56276] simplesamlphp DEBUG [ab6d3b55bc] Template: Reading [/var/www/simplesamlphp/modules/core/dictionaries/frontpage]
 
[Fri Apr 29 02:44:39.812422 2022] [php7:notice] [pid 17] [client 172.18.0.1:56276] simplesamlphp WARNING [ab6d3b55bc] The class or interface 'SimpleSAML_Logger' is now using namespaces, please use 'SimpleSAML\\Logger'.
 
[Fri Apr 29 02:44:56.293453 2022] [mpm_prefork:notice] [pid 1] AH00169: caught SIGTERM, shutting down
 
[Fri Apr 29 02:45:43.067555 2022] [ssl:warn] [pid 1] AH01906: localhost:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
 
[Fri Apr 29 02:45:43.067683 2022] [ssl:warn] [pid 1] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
 
[Fri Apr 29 02:45:43.146337 2022] [ssl:warn] [pid 1] AH01906: localhost:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
 
[Fri Apr 29 02:45:43.147314 2022] [ssl:warn] [pid 1] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
 
[Fri Apr 29 02:45:43.150282 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/7.1.13 OpenSSL/1.0.1t configured -- resuming normal operations
 
[Fri Apr 29 02:45:43.150685 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
 

@gitpod-io

gitpod-io Bot commented Apr 29, 2022

Copy link
Copy Markdown

humphd
humphd previously approved these changes Apr 29, 2022

@humphd humphd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I wonder if we should switch to a maintained version (there are a bunch of forks, https://github.com/kenchan0130/docker-simplesamlphp for example).

@humphd

humphd commented Apr 29, 2022

Copy link
Copy Markdown
Contributor

This is failing the same way as my PR in Vercel:



info  - Checking validity of types...
--
00:14:54.399 | Failed to compile.
00:14:54.399 |  
00:14:54.400 | ./src/components/AboutFooter.tsx:83:8
00:14:54.400 | Type error: 'Box' cannot be used as a JSX component.
00:14:54.400 | Its element type 'ReactElement<any, any> \| Component<BoxProps, any, any> \| null' is not a valid JSX element.
00:14:54.400 | Type 'Component<BoxProps, any, any>' is not assignable to type 'Element \| ElementClass \| null'.
00:14:54.400 | Type 'Component<BoxProps, any, any>' is not assignable to type 'ElementClass'.
00:14:54.400 | The types returned by 'render()' are incompatible between these types.
00:14:54.400 | Type 'React.ReactNode' is not assignable to type 'import("/vercel/path1/node_modules/@types/react-dom/node_modules/@types/react/index").ReactNode'.
00:14:54.400 | Type '{}' is not assignable to type 'ReactNode'.
00:14:54.400 | Type '{}' is missing the following properties from type 'ReactPortal': key, children, type, props
00:14:54.400 |  
00:14:54.400 | 81 \|   return (
00:14:54.401 | 82 \|     <Grid container className={classes.root}>
00:14:54.401 | > 83 \|       <Box width={1} pb={5}>
00:14:54.401 | \|        ^
00:14:54.401 | 84 \|         {matches ? (
00:14:54.401 | 85 \|           <Grid container direction="row" justifyContent="space-between" alignItems="flex-start">
00:14:54.401 | 86 \|             <Grid container item xs={12} sm={3}>
00:14:54.432 | npm ERR! code ELIFECYCLE
00:14:54.433 | npm ERR! errno 1
00:14:54.436 | npm ERR! @senecacdot/telescope-frontend@3.0.0 build: `next build && next export`
00:14:54.436 | npm ERR! Exit status 1
00:14:54.436 | npm ERR!
00:14:54.436 | npm ERR! Failed at the @senecacdot/telescope-frontend@3.0.0 build script.
00:14:54.436 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
00:14:54.445 |  
00:14:54.446 | npm ERR! A complete log of this run can be found in:
00:14:54.446 | npm ERR!     /vercel/.npm/_logs/2022-04-29T04_14_54_437Z-debug.log
00:14:54.465 | Error! Command "npm run build" exited with 1


@DukeManh

Copy link
Copy Markdown
Contributor Author

This is failing the same way as my PR in Vercel:

#3568 (comment)

@humphd humphd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is interesting, CI failing:

Run pnpm db:migrate

> @senecacdot/telescope@3.0.4 db:migrate /home/runner/work/telescope/telescope
> prisma migrate dev --schema=src/db/prisma/schema.prisma && prisma generate --schema=src/db/prisma/schema.prisma

Prisma schema loaded from src/db/prisma/schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "localhost:5432"

Error: P[10](https://github.com/Seneca-CDOT/telescope/runs/6242093737?check_suite_focus=true#step:10:10)01: Can't reach database server at `localhost`:`5432`

Please make sure your database server is running at `localhost`:`5432`.

I think we need to add a dedicated step to the CI jobs that waits on the db to become ready before we: a) migrate; or b) run e2e tests. We could so something like:

steps:
      # Pull, build, and run containers, then start e2e tests
      - 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 tcp:5432 http://localhost:8081/simplesaml
      - name: Apply database migrations
        run: pnpm db:migrate
      - run: pnpm jest:e2e

humphd
humphd previously approved these changes May 2, 2022
@@ -1,34 +1,14 @@
// eslint-disable-next-line
const { waitForPostgres } = require('@jcoreio/wait-for-postgres');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this dependency now then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I did

@humphd humphd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff.

@DukeManh DukeManh merged commit a445835 into Seneca-CDOT:master May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intermittent e2e failure: chromium running src/api/sso/test/e2e/signup-flow.test.js

2 participants