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

Add sanity test based on injected data. #78

Merged
merged 8 commits into from
Feb 1, 2019

Conversation

jason-fox
Copy link
Contributor

This PR is similar to ging/fiware-idm#69

  • Adds an ECMA6 code linter (run using npm run lint)
  • Ensures that the linter runs prior to commit
  • Runs the linter as part of the CI Build
  • Instantiates a Populated MySQL database for use with the Unit tests.
  • Runs code coverage as part of the CI Build (TSC should requirement)
    (the after_script in travis)
  • Adds a single unit test stub
    (no body to the tests)

* Remove unnecessry imports
* Correct heartbeat path
* Add dummy test data for Keyrock
* Add test stub and move sanity test to avoid coverage
* Alter default lint to allow camel case (since code currently violates this rule)
* Add default config so test can run.
* Update travis with best guess for starting relevant resources
* Add dev dependencies (e.g. Husky, Coveralls, Chai etc.)
@jason-fox
Copy link
Contributor Author

jason-fox commented Jan 22, 2019

Tests can be run locally with the following preparatory steps:

docker network create --driver=bridge my-network
docker run -d -h mysql -p 3306:3306 --net=my-network --name mysql -v $(pwd)/test/mysql-data:/docker-entrypoint-initdb.d/:ro -e MYSQL_ROOT_PASSWORD=test  mysql:5.7

docker pull fiware/idm:latest
docker run -d --net=my-network --name keyrock -p 3000:3000 -e IDM_DB_USER=root -e IDM_DB_PASS=test -e DATABASE_HOST=mysql -e IDM_DB_PORT=3306  fiware/idm:7.5.1 

npm test or npm run test:coverage works thereafter.

The sanity test has been altered to use a local Keyrock instance rather than relying on an existing Keystone on the net. Also incorporates parts of PR #73 which also ran the linter.

The same config.js change is necessary to get the PEP Proxy to run as in the Keyrock test.

The repo needs to be exposed on coveralls as well (obviously) - see https://coveralls.io/repos/new - this is the reason for the error message in the log:

{"message":"Couldn't find a repository matching this job.","error":true}

and the coverage:unknown badge

jason-fox and others added 2 commits February 1, 2019 10:28
@apozohue10
Copy link
Contributor

Merged! Thanks! We will work now on travis CI and code coverage.

@apozohue10 apozohue10 merged commit c6437e0 into ging:master Feb 1, 2019
@jason-fox jason-fox deleted the feature/test-stub branch October 6, 2020 09:31
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.

2 participants