onerostermicroservice

1.0.0 • Public • Published

oneroster

Running tests

There are three sets of tests in this project:

  1. Initial unit tests (very few).
  2. Legacy service integration tests for oneroster.
  3. Legacy service integration tests for gradecam.

Unit tests

Unit tests run with the jest framework. They require no additional, external dependencies.

$ npm test
$ npm run test.watch

Legacy service integration tests

NOTE: gradecam tests have not been verified as fixed yet.

Legacy service integration tests currently require a seeded local database backing the tests. This will be migrated to a clean docker-compose test environment in the future.

To setup the local DB test fixtures:

$ sed 's/apiedzoneserver_test/apiedzoneserver/' ../database/fixture/minimalDevDB.sql | mysql -h 127.0.0.1 -proot -uroot
$ cat test/seed.sql | mysql -h 127.0.0.1 -proot -uroot apiedzoneserver
$ cat test/minimalTestData.sql | mysql -h 127.0.0.1 -proot -uroot apiedzoneserver

Once setup, the test suite will attempt to clean up after itself on the same database instance.

Configure your mysql environment via .env file (see examples).

Test oneroster endpoints:

npm run test.oneroster

Docker Build

These were previosuly wrapped in a gulpfile, but are straight-forward commands:

docker build -t otus/oneroster .

Note that ONE_ROSTER_ENV may need to be set.

docker-compose setup

This service is part of the monolith docker-compose env set-up (this many change in the future)

Example:

`docker-compose build oneroster`
`docker compose up -d` will bring up all services (including oneroster) in socure-code/docker-compose.yml

oneroster will be available at PORT 9005 in the composed environment.

Configuration / Environment Variables

Variable Name Description
REDIS_HOST Host for Redis Connection
REDIS_PORT Port for Redis Connection
MYSQL_HOST Host to run mysql locally
MYSQL_USER Local mysql user
MYSQL_PASSWORD Local mysql password
GRADECAM_BASIC_AUTH Gradecam auth
GRADECAM_BASE_URL Gradecam base url
SERVER_URL OneRoster server url
FEED_SQS_URL Local feed SQS url
FEED_AWS_SQS_REGION aws region
FEED_AWS_KEY Key to access feed SQS
FEED_AWS_SECRET_ACCESS_KEY OneRoster server url

FORCED_PROTOCOL can be set to force 'http' or 'https' as the protocol of the url used to calculated a verify signed oauth 1.0 requests. If not set, assumes protocol from Request object.

This likely needs to be set with FORCED_PROTOCOL=https if behind a SSL terminating proxy.

Local Development

Create a .env file for yourself. Use .env.example as an example.

Deployed Environment

Environment variables are deployed as a sercrets configuration. See deployment.yml for more information

Readme

Keywords

none

Package Sidebar

Install

npm i onerostermicroservice

Weekly Downloads

0

Version

1.0.0

License

none

Unpacked Size

465 kB

Total Files

66

Last publish

Collaborators

  • otusci