Skip to content

chore(ci): run tests on multiple operating systems - #10526

Merged
aqrln merged 1 commit into
mainfrom
ci/multi-os
Dec 21, 2021
Merged

aqrln merged 1 commit into
mainfrom
ci/multi-os

Conversation

@aqrln

@aqrln aqrln commented Dec 1, 2021 •

Copy link
Copy Markdown
Member

Closes #7725

@aqrln aqrln added this to the 3.7.0 milestone Dec 1, 2021
@aqrln
aqrln force-pushed the ci/multi-os branch 5 times, most recently from 4002f22 to 4a85b17 Compare December 2, 2021 23:40
aqrln added a commit to prisma/prisma-engines that referenced this pull request Dec 6, 2021
Use `std::path::Path::file_name` instead of manually splitting the database file path by `/`.

This fixes a `@prisma/sdk` test failing on Windows on TypeScript side:

```
FAIL src/__tests__/introspection/introspection.test.ts
  × introspection basic (39 ms)

  ● introspection basic

    expect(received).toMatchInlineSnapshot(snapshot)

    Snapshot name: `introspection basic 3`

    - Snapshot  - 1
    + Received  + 1

      Array [
    -   "blog.db",
    +   "D:\\a\\prisma\\prisma\\packages\\sdk\\src\\__tests__\\introspection\\blog.db",
      ]

      56 |   `)
      57 |   const databases = await engine.listDatabases(schema)
    > 58 |   expect(databases).toMatchInlineSnapshot(`
         |                     ^
      59 |     Array [
      60 |       "blog.db",
      61 |     ]

      at Object.<anonymous> (src/__tests__/introspection/introspection.test.ts:58:21)

 › 1 snapshot failed.
```

Ref: prisma/orm#10526
aqrln added a commit to prisma/prisma-engines that referenced this pull request Dec 6, 2021
Use `std::path::Path::file_name` instead of manually splitting the database file path by `/`.

This fixes a `@prisma/sdk` test failing on Windows on TypeScript side:

```
FAIL src/__tests__/introspection/introspection.test.ts
  × introspection basic (39 ms)

  ● introspection basic

    expect(received).toMatchInlineSnapshot(snapshot)

    Snapshot name: `introspection basic 3`

    - Snapshot  - 1
    + Received  + 1

      Array [
    -   "blog.db",
    +   "D:\\a\\prisma\\prisma\\packages\\sdk\\src\\__tests__\\introspection\\blog.db",
      ]

      56 |   `)
      57 |   const databases = await engine.listDatabases(schema)
    > 58 |   expect(databases).toMatchInlineSnapshot(`
         |                     ^
      59 |     Array [
      60 |       "blog.db",
      61 |     ]

      at Object.<anonymous> (src/__tests__/introspection/introspection.test.ts:58:21)

 › 1 snapshot failed.
```

Ref: prisma/orm#10526
@aqrln
aqrln force-pushed the ci/multi-os branch 9 times, most recently from 47c8e6e to a64d74b Compare December 14, 2021 17:54
@aqrln
aqrln marked this pull request as ready for review December 16, 2021 17:50
@aqrln
aqrln requested review from Jolg42 and millsp as code owners December 16, 2021 17:50
@aqrln
aqrln requested a review from janpio December 16, 2021 17:51
@aqrln

aqrln commented Dec 16, 2021

Copy link
Copy Markdown
Member Author

And, finally, everything is green!

image

macOS tests look flaky, so I'm not sure about those

  • some tests were failing randomly occasionally and then just worked on the next run, and I couldn't reproduce those failures locally on my mac
  • a bunch of tests required much higher timeouts

Currently they are passing, but they may turn out to be a headache later. Should we maybe extract macOS to a separate optional workflow that won't block the PRs?

Windows tests seem to be pretty robust 🎉

@aqrln

aqrln commented Dec 16, 2021

Copy link
Copy Markdown
Member Author

Squashed the 90 commits into one and rebased onto the latest main. Let's see if it works now 🤞

Comment thread .github/workflows/install-mysql.ps1 Resolved
Comment thread .github/workflows/test.yml Resolved
Comment thread .github/workflows/test.yml Resolved
Comment thread .github/workflows/test.yml Resolved
@aqrln

aqrln commented Dec 17, 2021 •

Copy link
Copy Markdown
Member Author

I wonder how can this test be non-deterministic and just spontaneously swapping two lines compared to a snapshot on binary, ubuntu-latest, 12. I've never seen it fail before on Linux previously, but saw either this or a similar test failing on macOS in a similar way once (except the "Applying migration" line was moved even further down).

FAIL src/__tests__/MigrateDeploy.test.ts
FAIL src/__tests__/MigrateDeploy.test.ts
  common
    ✓ should fail if no schema file (3 ms)
    ✓ should fail if experimental flag (1 ms)
    ✓ should fail if early access flag (1 ms)
  sqlite
    ✓ no unapplied migrations (341 ms)
    ✕ 1 unapplied migration (577 ms)
    ✓ should throw if database is not empty (263 ms)

  ● sqlite › 1 unapplied migration

    expect(received).toMatchInlineSnapshot(snapshot)

    Snapshot name: `sqlite 1 unapplied migration 3`

    - Snapshot  - 1
    + Received  + 1

    @@ -3,12 +3,12 @@

      SQLite database dev.db created at file:dev.db

      1 migration found in prisma/migrations

    +
      Applying migration `20201231000000_init`
    -
      Prisma schema loaded from prisma/schema.prisma
      Datasource "my_db": SQLite database "dev.db" at "file:dev.db"

      1 migration found in prisma/migrations
      ↵

      79 |
      80 |     expect(ctx.mocked['console.info'].mock.calls.join('\n'))
    > 81 |       .toMatchInlineSnapshot(`
         |        ^
      82 |       Prisma schema loaded from prisma/schema.prisma
      83 |       Datasource "my_db": SQLite database "dev.db" at "file:dev.db"
      84 |

      at Object.<anonymous> (src/__tests__/MigrateDeploy.test.ts:81:8)
          at runMicrotasks (<anonymous>)

 › 1 snapshot failed.

@Jolg42

Jolg42 commented Dec 17, 2021 •

Copy link
Copy Markdown
Contributor

@aqrln likely because this is a log line coming from the engine and not the CLI so the timing can vary slightly, not related to this PR here, looks flaky

Comment thread .github/workflows/test.yml Resolved
Comment thread .github/workflows/test.yml Resolved

@millsp millsp 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.

Awesome work 🎉 💯.
(PS: let's create an issue for the remaining todos)

tomhoule pushed a commit to prisma/prisma-engines that referenced this pull request Dec 20, 2021
Use `std::path::Path::file_name` instead of manually splitting the database file path by `/`.

This fixes a `@prisma/sdk` test failing on Windows on TypeScript side:

```
FAIL src/__tests__/introspection/introspection.test.ts
  × introspection basic (39 ms)

  ● introspection basic

    expect(received).toMatchInlineSnapshot(snapshot)

    Snapshot name: `introspection basic 3`

    - Snapshot  - 1
    + Received  + 1

      Array [
    -   "blog.db",
    +   "D:\\a\\prisma\\prisma\\packages\\sdk\\src\\__tests__\\introspection\\blog.db",
      ]

      56 |   `)
      57 |   const databases = await engine.listDatabases(schema)
    > 58 |   expect(databases).toMatchInlineSnapshot(`
         |                     ^
      59 |     Array [
      60 |       "blog.db",
      61 |     ]

      at Object.<anonymous> (src/__tests__/introspection/introspection.test.ts:58:21)

 › 1 snapshot failed.
```

Ref: prisma/orm#10526
@aqrln

aqrln commented Dec 20, 2021

Copy link
Copy Markdown
Member Author

Need to coordinate merging with #10772

Co-authored-by: Jan Piotrowski <[email protected]>
Co-authored-by: Pierre-Antoine Mills <[email protected]>
@aqrln
aqrln merged commit a397c78 into main Dec 21, 2021
@aqrln
aqrln deleted the ci/multi-os branch December 21, 2021 12:12
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.

Run (most) tests on all operating system

4 participants