jena icon indicating copy to clipboard operation
jena copied to clipboard

`yarn run test:e2e` fails on MS Windows.

Open afs opened this issue 11 months ago • 5 comments

The test:e2e step of the frontend-maven-plugin in jena-fuseki-ui is not managing to run the tests.

This log is from the projects github action for MS Windows.

[INFO] --- frontend-maven-plugin:1.15.0:yarn (yarn run test:e2e) @ jena-fuseki-ui ---
[INFO] Running 'yarn run test:e2e' in C:\jena\jena-fuseki2\jena-fuseki-ui
[INFO] yarn run v1.22.17
[INFO] $ cross-env FUSEKI_PORT="${FUSEKI_PORT:=3030}" PORT="${PORT:=8080}" concurrently --names 'SERVER,CLIENT,TESTS' --prefix-colors 'yellow,blue,green' --success 'first' --kill-others 'yarn run serve:fuseki' 'yarn wait-on http://localhost:${FUSEKI_PORT}/$/ping && yarn run dev' 'yarn wait-on http-get://localhost:${PORT}/index.html && cypress run $@'
[INFO] [CLIENT] 'run' is not recognized as an internal or external command,
[INFO] [CLIENT] operable program or batch file.
[INFO] [TESTS] The filename, directory name, or volume label syntax is incorrect.
[INFO] [TESTS] serve:fuseki exited with code 1
[INFO] --> Sending SIGTERM to other processes..
[INFO] [CLIENT] run exited with code 1
[INFO] --> Sending SIGTERM to other processes..
[INFO] [5] 'http:' is not recognized as an internal or external command,
[INFO] [5] operable program or batch file.
[INFO] [5] http://localhost:%FUSEKI_PORT%/$/ping exited with code 1
[INFO] --> Sending SIGTERM to other processes..
[INFO] [SERVER] yarn exited with code 1
[INFO] --> Sending SIGTERM to other processes..
[INFO] [3] yarn exited with code 1
[INFO] --> Sending SIGTERM to other processes..
[INFO] [4] wait-on exited with code 1
[INFO] error Command failed with exit code 1.
[INFO] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error:  There are test failures.
Failed to run task: 'yarn run test:e2e' failed.

afs avatar Mar 16 '24 21:03 afs

Oh, I wonder if the version used on Windows is not happy about yarn run $target. It's the old style, and nowadays I believe it's moving towards yarn $target. I have Windows installed on another partition at home and $work... cannot remember the password of either, but I should be able to log in and run some tests over next days if no one beats me to it.

kinow avatar Mar 16 '24 22:03 kinow

Booted into Windows after a long time, then

  • installed nodejs.org 22.01.1 LTS
  • updated npm as per their cmd line output message
  • installed Yarn globally with npm
  • cloned latest Jena and cd'ed into jena-fuseki-ui
  • yarn install, which worked fine with some warnings
  • yarn run test:e2e

The last command resulted in the same error message reported.

image

I removed the run part of the commands, but yarn test:e2e failed again complaining http: is not a command :thinking:

kinow avatar Mar 19 '24 09:03 kinow

complaining http: is not a command

The good news is that it is not trying to run the internet. That might take some time.

afs avatar Mar 19 '24 11:03 afs

Oh, I forgot to comment here, but I tested again after my last comment and it seemed to fail with concurrently. In our package.json, the test:e2e calls concurrently https://github.com/apache/jena/blob/7b3e36afd6e42972c717ac9bc4be26e03a5e07d2/jena-fuseki2/jena-fuseki-ui/package.json#L13

I found other issues from users with problems using concurrently+Windows

  • https://github.com/open-cli-tools/concurrently/issues/208
  • https://github.com/open-cli-tools/concurrently/issues/167

I will try again next time I boot on Windows, but if anyone needs to run the tests on windows right now, it'd be simpler to just run on different terminals yarn serve:fuseki, yarn dev, and npx cypress run.

kinow avatar Mar 26 '24 19:03 kinow

This was more tinkering than I anticipated for getting something to work.

There is a new dev dependency for fixing this: run-script-os (runs OS-specific commands, in this case *nix for mac + linux, and windows) https://github.com/charlesguse/run-script-os#readme Dependency has MIT license and looks used, but hasn’t been updated in some time.

Passing on windows, passing on MacOS, passing on Ubuntu

Some additional notes:

  • set /a (https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/set_1) is used to set a numerical expression with bitwise exclusive or on the port set by maven (or undefined, which falls back to 0) I haven't checked if this works on a windows machine, by calling yarn run test:e2e in the jena-fuseki-ui folder, since I don’t currently have one available.
  • Github windows CI uses poweshell as the default shell since 2019
  • windows github actions calls maven using bash -c (shell can be configured shell parameter, which would maybe be cleaner? https://github.blog/changelog/2019-10-17-github-actions-default-shell-on-windows-runners-is-changing-to-powershell/
  • yarn (1) calls cmd as default when running from windows. Tried adding it in pom.xml using yarn config set script-shell bash, in order to use the same test:e2e for all scripts, but didn’t get it to work.
  • Tests pass locally on my Mac but gives a bad exit code when cleaning up:
jena-fuseki-ui % yarn run test:e2e
yarn run v1.22.22
$ run-script-os
$ cross-env FUSEKI_PORT="${FUSEKI_PORT:=3030}" PORT="${PORT:=8080}" concurrently  --names 'SERVER,CLIENT,TESTS' --prefix-colors 'yellow,blue,green' --success 'first' --kill-others "yarn run serve:fuseki" "yarn wait-on http://localhost:${FUSEKI_PORT}/$/ping && yarn run dev" "yarn wait-on http-get://localhost:${PORT}/index.html && cypress run $@"
$ /Users/oyvindlgjesdal/repos/apache/jena/jena-fuseki2/jena-fuseki-ui/node_modules/.bin/wait-on 'http://localhost:3030/$/ping'
$ nodemon src/services/mock/json-server.js
$ /Users/oyvindlgjesdal/repos/apache/jena/jena-fuseki2/jena-fuseki-ui/node_modules/.bin/wait-on http-get://localhost:8080/index.html
[SERVER] [nodemon] 3.1.0
[SERVER] [nodemon] to restart at any time, enter `rs`
[SERVER] [nodemon] watching path(s): *.*
[SERVER] [nodemon] watching extensions: js,mjs,cjs,json
[SERVER] [nodemon] starting `node src/services/mock/json-server.js`
[SERVER] JSON Server is running
[SERVER] HEAD /$/ping 200 3.360 ms - 40
$ vite
[SERVER] [nodemon] restarting due to changes...
[SERVER] [nodemon] starting `node src/services/mock/json-server.js`
[SERVER] JSON Server is running
[SERVER] [nodemon] restarting due to changes...
[SERVER] [nodemon] starting `node src/services/mock/json-server.js`
[CLIENT] Re-optimizing dependencies because lockfile has changed
[CLIENT] 
[CLIENT]   VITE v5.2.11  ready in 2875 ms
[CLIENT] 
[CLIENT]   ➜  Local:   http://localhost:8080/
[CLIENT]   ➜  Network: use --host to expose
[SERVER] JSON Server is running
[TESTS] It looks like this is your first time using Cypress: 13.10.0
[TESTS] 
[TESTS] [STARTED] Task without title.
[TESTS] [TITLE]  Verified Cypress! /Users/oyvindlgjesdal/Library/Caches/Cypress/13.10.0/Cypress.app
[TESTS] [SUCCESS]  Verified Cypress! /Users/oyvindlgjesdal/Library/Caches/Cypress/13.10.0/Cypress.app
[TESTS] 
[TESTS] Opening Cypress...
[TESTS] 
[TESTS] DevTools listening on ws://127.0.0.1:54976/devtools/browser/10852f72-0c11-4a47-8cbc-ef41829445e5
[TESTS] 
[TESTS] ====================================================================================================
[TESTS] 
[TESTS]   (Run Starting)
[TESTS] 
[TESTS]   ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
[TESTS]   │ Cypress:        13.10.0                                                                        │
[TESTS]   │ Browser:        Electron 118 (headless)                                                        │
[TESTS]   │ Node Version:   v20.12.2 (/Users/oyvindlgjesdal/.nvm/versions/node/v20.12.2/bin/node)          │
[TESTS]   │                 m                                                                              │
[TESTS]   │ Specs:          3 found (datasets.cy.js, query.cy.js, upload.cy.js)                            │
[TESTS]   │ Searched:       tests/e2e/specs/**/*.cy.{js,jsx,ts,tsx}                                        │
[TESTS]   └────────────────────────────────────────────────────────────────────────────────────────────────┘
[TESTS] 
[TESTS] 
[TESTS] ────────────────────────────────────────────────────────────────────────────────────────────────────
[TESTS]                                                                                                     
[TESTS]   Running:  datasets.cy.js                                                                  (1 of 3)
[SERVER] [nodemon] restarting due to changes...
[SERVER] [nodemon] starting `node src/services/mock/json-server.js`
[SERVER] JSON Server is running
[SERVER] [nodemon] restarting due to changes...
[SERVER] [nodemon] starting `node src/services/mock/json-server.js`
[TESTS] Generated an empty chunk: "index".
[SERVER] JSON Server is running
[TESTS] 
[TESTS] 
[TESTS]   datasets
[TESTS]     without any datasets
[SERVER] GET /tests/reset 200 1.052 ms - 2
[SERVER] GET /$/ping 200 0.369 ms - 40
[SERVER] GET /$/server 200 0.197 ms - 104
[TESTS]       ✓ Visits datasets page, also the application landing-page (337ms)
[SERVER] GET /$/ping 200 0.203 ms - 40
[SERVER] GET /$/server 304 0.129 ms - -
[SERVER] GET /tests/reset 200 0.372 ms - 2
[TESTS]       ✓ Filters without any data (323ms)
[TESTS]     after creating new datasets
[SERVER] GET /tests/reset 200 0.131 ms - 2
[SERVER] GET /$/ping 200 0.145 ms - 40
[SERVER] POST /$/datasets 200 86.474 ms - 2
[SERVER] GET /$/server 200 0.173 ms - -
[SERVER] POST /$/datasets 200 0.571 ms - 2
[SERVER] GET /$/server 200 0.324 ms - -
[SERVER] POST /$/datasets 200 0.401 ms - 2
[SERVER] GET /$/server 200 0.192 ms - -
[SERVER] POST /$/datasets 200 0.436 ms - 2
[SERVER] GET /$/server 200 0.202 ms - -
[SERVER] POST /$/datasets 200 0.419 ms - 2
[SERVER] GET /$/server 200 0.229 ms - -
[SERVER] POST /$/datasets 200 0.675 ms - 2
[SERVER] GET /$/server 200 0.208 ms - -
[SERVER] POST /$/datasets 200 0.525 ms - 2
[SERVER] GET /$/server 200 0.259 ms - -
[SERVER] POST /$/datasets 200 0.521 ms - 2
[SERVER] GET /$/server 200 0.221 ms - -
[SERVER] POST /$/datasets 200 0.637 ms - 2
[SERVER] GET /$/server 200 0.236 ms - -
[SERVER] POST /$/datasets 200 0.493 ms - 2
[SERVER] GET /$/server 200 0.289 ms - -
[SERVER] POST /$/datasets 200 0.393 ms - 2
[SERVER] GET /$/server 200 0.245 ms - -
[SERVER] GET /$/server 304 0.175 ms - -
[SERVER] GET /$/stats/a 200 0.274 ms - -
[SERVER] GET /a/sparql?query=select+(count(*)+as+%3Fcount)+%7B%3Fs+%3Fp+%3Fo%7D 200 0.176 ms - 259
[SERVER] GET /a/sparql?query=select+%3Fg+(count(*)+as+%3Fcount)+%7Bgraph+%3Fg+%7B%3Fs+%3Fp+%3Fo%7D%7D+group+by+%3Fg 200 0.067 ms - 103
[SERVER] GET /a/data?graph=default 200 0.164 ms - 257
[TESTS]       ✓ Edits the graph (3794ms)
[SERVER] GET /$/ping 200 0.148 ms - 40
[SERVER] GET /$/server 304 0.185 ms - -
[TESTS]       ✓ Visits datasets page (123ms)
[SERVER] GET /$/ping 200 0.150 ms - 40
[SERVER] GET /$/server 304 0.161 ms - -
[TESTS]       ✓ Uses the table pagination (188ms)
[SERVER] GET /$/ping 200 0.224 ms - 40
[SERVER] GET /$/server 304 0.138 ms - -
[TESTS]       ✓ Sorts the table (287ms)
[SERVER] GET /$/ping 200 0.149 ms - 40
[SERVER] GET /$/server 200 0.201 ms - -
[TESTS]       ✓ Filters the table (365ms)
[SERVER] GET /$/ping 200 0.152 ms - 40
[SERVER] GET /$/server 304 0.180 ms - -
[SERVER] POST /$/datasets 409 0.554 ms - 37
[TESTS]       ✓ Cannot add two datasets with the same name (450ms)
[SERVER] GET /$/ping 200 0.332 ms - 40
[SERVER] GET /$/server 200 0.175 ms - -
[SERVER] GET /$/stats/a 304 0.160 ms - -
[SERVER] GET /a/sparql?query=select+(count(*)+as+%3Fcount)+%7B%3Fs+%3Fp+%3Fo%7D 304 0.165 ms - -
[SERVER] GET /a/sparql?query=select+%3Fg+(count(*)+as+%3Fcount)+%7Bgraph+%3Fg+%7B%3Fs+%3Fp+%3Fo%7D%7D+group+by+%3Fg 304 0.090 ms - -
[SERVER] GET /$/stats/a 304 0.124 ms - -
[SERVER] GET /tests/reset 200 0.166 ms - 2
[TESTS]       ✓ Visualizes the dataset information (Info View, tab) (332ms)
[TESTS] 
[TESTS] 
[TESTS]   9 passing (6s)
[TESTS] 
[TESTS] 
[TESTS]   (Results)
[TESTS] 
[TESTS]   ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
[TESTS]   │ Tests:        9                                                                                │
[TESTS]   │ Passing:      9                                                                                │
[TESTS]   │ Failing:      0                                                                                │
[TESTS]   │ Pending:      0                                                                                │
[TESTS]   │ Skipped:      0                                                                                │
[TESTS]   │ Screenshots:  0                                                                                │
[TESTS]   │ Video:        false                                                                            │
[TESTS]   │ Duration:     6 seconds                                                                        │
[TESTS]   │ Spec Ran:     datasets.cy.js                                                                   │
[TESTS]   └────────────────────────────────────────────────────────────────────────────────────────────────┘
[TESTS] 
[TESTS] 
[TESTS] ────────────────────────────────────────────────────────────────────────────────────────────────────
[TESTS]                                                                                                     
[TESTS]   Running:  query.cy.js                                                                     (2 of 3)
[TESTS] 
[TESTS] 
[TESTS]   Query
[SERVER] GET /tests/reset 200 0.121 ms - 2
[SERVER] GET /$/ping 200 0.188 ms - 40
[SERVER] POST /$/datasets 200 0.480 ms - 2
[SERVER] GET /$/server 200 0.169 ms - -
[SERVER] GET /$/server 200 0.166 ms - -
[SERVER] GET /$/stats/skosmos 200 0.171 ms - -
[SERVER] GET /tests/reset 200 0.171 ms - 2
[TESTS]     ✓ Uses the correct SPARQL Endpoint (1333ms)
[SERVER] GET /tests/reset 200 0.127 ms - 2
[SERVER] GET /$/ping 200 0.233 ms - 40
[SERVER] POST /$/datasets 200 0.781 ms - 2
[SERVER] GET /$/server 200 0.161 ms - -
[SERVER] GET /$/server 304 0.151 ms - -
[SERVER] GET /$/stats/skosmos 304 0.178 ms - -
[SERVER] GET /tests/reset 200 0.128 ms - 2
[TESTS]     ✓ Can resize the query editor (856ms)
[TESTS] 
[TESTS] 
[TESTS]   2 passing (2s)
[TESTS] 
[TESTS] 
[TESTS]   (Results)
[TESTS] 
[TESTS]   ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
[TESTS]   │ Tests:        2                                                                                │
[TESTS]   │ Passing:      2                                                                                │
[TESTS]   │ Failing:      0                                                                                │
[TESTS]   │ Pending:      0                                                                                │
[TESTS]   │ Skipped:      0                                                                                │
[TESTS]   │ Screenshots:  0                                                                                │
[TESTS]   │ Video:        false                                                                            │
[TESTS]   │ Duration:     2 seconds                                                                        │
[TESTS]   │ Spec Ran:     query.cy.js                                                                      │
[TESTS]   └────────────────────────────────────────────────────────────────────────────────────────────────┘
[TESTS] 
[TESTS] 
[TESTS] ────────────────────────────────────────────────────────────────────────────────────────────────────
[TESTS]                                                                                                     
[TESTS]   Running:  upload.cy.js                                                                    (3 of 3)
[TESTS] 
[TESTS] 
[TESTS]   upload
[SERVER] GET /tests/reset 200 0.124 ms - 2
[SERVER] GET /$/ping 200 0.113 ms - 40
[SERVER] POST /$/datasets 200 0.657 ms - 2
[SERVER] GET /$/server 200 0.159 ms - -
[SERVER] GET /$/server 304 0.131 ms - -
[SERVER] GET /$/stats/skosmos 200 0.155 ms - -
[SERVER] GET /tests/reset 200 0.121 ms - 2
[TESTS]     ✓ displays an empty progress bar by default (726ms)
[SERVER] GET /tests/reset 200 0.115 ms - 2
[SERVER] GET /$/ping 200 0.199 ms - 40
[SERVER] POST /$/datasets 200 0.528 ms - 2
[SERVER] GET /$/server 304 0.169 ms - -
[SERVER] GET /$/server 304 0.175 ms - -
[SERVER] GET /$/stats/skosmos 304 0.154 ms - -
[SERVER] GET /tests/reset 200 0.220 ms - 2
[TESTS]     ✓ displays the progress for success and failure (847ms)
[TESTS] 
[TESTS] 
[TESTS]   2 passing (2s)
[TESTS] 
[TESTS] 
[TESTS]   (Results)
[TESTS] 
[TESTS]   ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
[TESTS]   │ Tests:        2                                                                                │
[TESTS]   │ Passing:      2                                                                                │
[TESTS]   │ Failing:      0                                                                                │
[TESTS]   │ Pending:      0                                                                                │
[TESTS]   │ Skipped:      0                                                                                │
[TESTS]   │ Screenshots:  0                                                                                │
[TESTS]   │ Video:        false                                                                            │
[TESTS]   │ Duration:     1 second                                                                         │
[TESTS]   │ Spec Ran:     upload.cy.js                                                                     │
[TESTS]   └────────────────────────────────────────────────────────────────────────────────────────────────┘
[TESTS] 
[TESTS] 
[TESTS] ====================================================================================================
[TESTS] 
[TESTS]   (Run Finished)
[TESTS] 
[TESTS] 
[TESTS]        Spec                                              Tests  Passing  Failing  Pending  Skipped  
[TESTS]   ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
[TESTS]   │ ✔  datasets.cy.js                           00:06        9        9        -        -        - │
[TESTS]   ├────────────────────────────────────────────────────────────────────────────────────────────────┤
[TESTS]   │ ✔  query.cy.js                              00:02        2        2        -        -        - │
[TESTS]   ├────────────────────────────────────────────────────────────────────────────────────────────────┤
[TESTS]   │ ✔  upload.cy.js                             00:01        2        2        -        -        - │
[TESTS]   └────────────────────────────────────────────────────────────────────────────────────────────────┘
[TESTS]     ✔  All specs passed!                        00:10       13       13        -        -        -  
[TESTS] 
[TESTS] yarn wait-on http-get://localhost:8080/index.html && cypress run  exited with code 0
--> Sending SIGTERM to other processes..
[SERVER] yarn run serve:fuseki exited with code 1
--> Sending SIGTERM to other processes..
[CLIENT] yarn wait-on http://localhost:3030/$/ping && yarn run dev exited with code SIGTERM
✨  Done in 32.92s.

OyvindLGjesdal avatar May 26 '24 22:05 OyvindLGjesdal