NOTE: ALL COMMANDS BELOW EXECUTE UNDER
<legacy-sub-procecssor>directory
Build Kafka image:
docker-compose build kafkaRun Kafka server:
docker-compose up -d kafka
docker exec -ti kafka bash -c "kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic submission.notification.create"
docker exec -ti kafka bash -c "kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic submission.notification.update"Make sure you're running a clean database (you can take down and remove iif_innovator_c container and then up it again)
export DB_SERVER_NAME=informix
docker kill iif_innovator_c
docker rm iif_innovator_c
docker-compose up -d tc-informix
docker logs iif_innovator_c
# When you see log like following then informix is started:
# starting rest listener on port 27018
# starting mongo listener on port 27017Then insert test data (which will be used by Unit Tests step and Verification step):
docker cp test/sql/test.sql iif_innovator_c:/
docker exec -ti iif_innovator_c bash -c "source /home/informix/ifx_informixoltp_tcp.env && dbaccess - /test.sql"We only need to do this once
export DB_SERVER_NAME=informix
docker-compose build lsp-appexport DB_SERVER_NAME=informix
rm -rf node_modules && docker-compose run lsp-app-installNote, if the legacy-processor-module is changed locally (e.g. during local dev and not pushed to git yet), then you need to delete it from node_modules and copy the local changed one to node_modules:
rm -rf ./node_modules/legacy-processor-module
cp -rf <path/to/legacy-processor-module> ./node_modules
# e.g cp -rf ../legacy-processor-module ./node_modules- Check code style
npm run lint - Check code style with option to fix the errors
npm run lint:fix
- Stop
legacy-sub-processorapplication if it was running:docker stop lsp-app - Make sure kafka container running with topic created and informix container running with test data inserted
- Run unit tests:
docker-compose run lsp-app-testDeploy first:
export DB_SERVER_NAME=informix
docker-compose up lsp-app-
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event different-topic"and verify that the app doesn't consume this message (no log) -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event null-message"and verify that the app skips this message (log:Skipped null or empty event) -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event empty-message"and verify that the app skips this message (log:Skipped null or empty event) -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event invalid-json"and verify that the app skips this message (log:Skipped Invalid message JSON) -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event empty-json"and verify that the app skips this message (log:Skipped the message topic "undefined" doesn't match the Kafka topic submission.notification.create) -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event invalid-payload"and verify that the app skips this message (log:Skipped invalid event, reasons: "timestamp" must be...) -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event wrong-topic"and verify that the app skips this message (log:Skipped the message topic "wrong-topic" doesn't match the Kafka topic submission.notification.create) -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event wrong-originator"and verify that the app skips this message (log:Skipped event from topic wrong-originator) -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event submission"and verify that the app makes call to the Submission API successfully (log:Successfully processed non MM message - Patched to the Submission API: id 111, patch: {"legacySubmissionId":60000}) and the Mock API log (docker logs mock-api) likePatch /submissions/111 with {"legacySubmissionId":60000}. -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event final-fix"and verify that the app has log likefinal fix upload, only insert upload, and it should only insert intouploadtable, but notsubmission/resource_submissiontable. -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event not-allow-multiple"and verify that the app has log likedelete previous submission for challengeId.... -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event update-url"and verify that the app has log likeSuccessfully processed non MM message - Submission url updated.... -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event no-challenge-props"and verify that the app has error log likeError: null or empty result get challenge properties.... -
Run
docker exec -ti lsp-app bash -c "npm run produce-test-event mm-submission"and verify that the app skips this message (log:Skipped event for subTrack: DEVELOP_MARATHON_MATCH).
Open your database explorer (DBeaver application, for instance). Connect to database tcs_catalog
Check table: upload, submission and resource_submission
After verification, run docker-compose down to take down and remove containers.