1.0.0 • Published 3 years ago

onerostermicroservice v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

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 NameDescription
REDIS_HOSTHost for Redis Connection
REDIS_PORTPort for Redis Connection
MYSQL_HOSTHost to run mysql locally
MYSQL_USERLocal mysql user
MYSQL_PASSWORDLocal mysql password
GRADECAM_BASIC_AUTHGradecam auth
GRADECAM_BASE_URLGradecam base url
SERVER_URLOneRoster server url
FEED_SQS_URLLocal feed SQS url
FEED_AWS_SQS_REGIONaws region
FEED_AWS_KEYKey to access feed SQS
FEED_AWS_SECRET_ACCESS_KEYOneRoster 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