Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit test runner is failing #312

Closed
mgstauffer opened this issue Feb 5, 2021 · 6 comments
Closed

unit test runner is failing #312

mgstauffer opened this issue Feb 5, 2021 · 6 comments

Comments

@mgstauffer
Copy link
Contributor

In current master branch. Attaching a shell to a running docker container and running the unit test runner generates these errors:

root@dcbe16be5338:/appsrc# sh tests/unit/unit_test_runner.sh
: not foundunit_test_runner.sh: 2: tests/unit/unit_test_runner.sh:
: not foundunit_test_runner.sh: 6: tests/unit/unit_test_runner.sh:
: not foundunit_test_runner.sh: 7: tests/unit/unit_test_runner.sh:
: not foundunit_test_runner.sh: 19: tests/unit/unit_test_runner.sh:
: not foundunit_test_runner.sh: 21: tests/unit/unit_test_runner.sh:
: not foundunit_test_runner.sh: 25: tests/unit/unit_test_runner.sh:
mkdir: cannot create directory ‘target/test-reports/cobertura/html\r’: Input/output error
mkdir: cannot create directory ‘target/test-reports/html\r’: Input/output error
: not foundunit_test_runner.sh: 28: tests/unit/unit_test_runner.sh:
starting nosetest
 lab/pyutils/tests/test_validateDataset.pys.pyy
: not foundunit_test_runner.sh: 31: tests/unit/unit_test_runner.sh:
tests/unit/unit_test_runner.sh: 32: tests/unit/unit_test_runner.sh: coverage: not found
tests/unit/unit_test_runner.sh: 33: tests/unit/unit_test_runner.sh: --with-xunit: not found
tests/unit/unit_test_runner.sh: 34: tests/unit/unit_test_runner.sh: --with-html: not found
tests/unit/unit_test_runner.sh: 35: tests/unit/unit_test_runner.sh: -v: not found
: not foundunit_test_runner.sh: 38: tests/unit/unit_test_runner.sh:
tests/unit/unit_test_runner.sh: 39: tests/unit/unit_test_runner.sh: coverage: not found
tests/unit/unit_test_runner.sh: 40: tests/unit/unit_test_runner.sh: coverage: not found
tests/unit/unit_test_runner.sh: 41: tests/unit/unit_test_runner.sh: coverage: not found
: not foundunit_test_runner.sh: 42: tests/unit/unit_test_runner.sh:
coverage erase
tests/unit/unit_test_runner.sh: 44: tests/unit/unit_test_runner.sh: coverage: not found
: not foundunit_test_runner.sh: 45: tests/unit/unit_test_runner.sh:
starting mocha tests
tests/unit/unit_test_runner.sh: 47: tests/unit/unit_test_runner.sh: mocha: not found
: not foundunit_test_runner.sh: 48: tests/unit/unit_test_runner.sh:
: not foundunit_test_runner.sh: 49: tests/unit/unit_test_runner.sh:
: not foundunit_test_runner.sh: 52: tests/unit/unit_test_runner.sh:
starting lab jest reports
tests/unit/unit_test_runner.sh: 54: cd: can't cd to /appsrc/lab/
npm ERR! path /appsrc/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/appsrc/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-02-05T23_01_08_895Z-debug.log
: not foundunit_test_runner.sh: 56: tests/unit/unit_test_runner.sh:
: not foundunit_test_runner.sh: 57: tests/unit/unit_test_runner.sh:
starting webapp jest reports
tests/unit/unit_test_runner.sh: 59: cd: can't cd to /appsrc/lab/webapp/
npm ERR! path /appsrc/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/appsrc/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-02-05T23_01_09_126Z-debug.log
: not foundunit_test_runner.sh: 61: tests/unit/unit_test_runner.sh:
@hjwilli
Copy link
Collaborator

hjwilli commented Feb 10, 2021

Hi @mgstauffer , this might be caused by your local version of unit_test_runner.sh having windows (CLRF) line endings.

Try running dos2unix first and see if you get the same error ( dos2unix tests/unit/unit_test_runner.sh && sh tests/unit/unit_test_runner.sh)

If you run the unit tests using docker-compose-unit-tests.yaml instead of attaching to a running container, this happens automatically.

@mgstauffer
Copy link
Contributor Author

@hjwilli Interesting! After converting to unix line endings, I'm still getting the coverage: not found error for nosetest. But the other tests are running. I think Weixuan said the coverage: not found was due to something else?

I looked in .gitattributes and it does not have the text=auto option set to have line endings converted to linux formating on upload/push. Do we want that? I do see that it is setting some files like .sh files to always checkout with LF line endings. I must have edited my local version with a windows editor at some point. Do you know if now I need to commit the changes to the files' line endings and push up again?

@hjwilli
Copy link
Collaborator

hjwilli commented Feb 18, 2021

@hjwilli Interesting! After converting to unix line endings, I'm still getting the coverage: not found error for nosetest. But the other tests are running.

Seems like it doesn't see the coverage python package, which is part of the testing dependencies that are only installed as part of the unit test docker image. How are you running the tests (which compose file are you using) and what branch are you in? Does the normal unit test command (docker-compose -f .\docker-compose-unit-test.yml up --abort-on-container-exit -V) work?

I must have edited my local version with a windows editor at some point. Do you know if now I need to commit the changes to the files' line endings and push up again?

This is likely what happened. You shouldn't need to re-commit.

hjwilli added a commit that referenced this issue Feb 19, 2021
separate scripts for python and javascript unit test runners
python unit test runner no longer uses relative paths

ref #312
@hjwilli
Copy link
Collaborator

hjwilli commented Feb 19, 2021

Hi @mgstauffer . Made some updates related to this in PR #314 , which has been merged to master. You can now use /tests/unit/js_tests.sh to run just the javascript unit tests.

@mgstauffer
Copy link
Contributor Author

mgstauffer commented Feb 19, 2021 via email

@hjwilli
Copy link
Collaborator

hjwilli commented Apr 16, 2021

resolved!

@hjwilli hjwilli closed this as completed Apr 16, 2021
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

No branches or pull requests

2 participants