diff --git a/services/.env b/services/.env index 4a5a0de60..c53f77318 100644 --- a/services/.env +++ b/services/.env @@ -1,6 +1,5 @@ COMM_SERVICES_PORT_TUNNELBROKER=50051 COMM_SERVICES_PORT_BACKUP=50052 COMM_SERVICES_PORT_BLOB=50053 COMM_SERVICES_PORT_IDENTITY=50054 COMM_SERVICES_PORT_FEATURE_FLAGS=50055 -COMM_TEST_SERVICES=0 diff --git a/services/docker-compose.yml b/services/docker-compose.yml index 34616fb1a..3917e8262 100644 --- a/services/docker-compose.yml +++ b/services/docker-compose.yml @@ -1,97 +1,96 @@ version: '3.9' volumes: localstack: services: # tunnelbroker tunnelbroker-server: depends_on: - localstack - rabbitmq build: dockerfile: services/tunnelbroker/Dockerfile context: ../ image: commapp/tunnelbroker-server:0.5 ports: - '${COMM_SERVICES_PORT_TUNNELBROKER}:50051' volumes: - $HOME/.aws/config:/home/comm/.aws/config:ro - $HOME/.aws/credentials:/home/comm/.aws/credentials:ro # backup backup-server: depends_on: - localstack - blob-server build: dockerfile: services/backup/Dockerfile context: ../ args: - - COMM_TEST_SERVICES=${COMM_TEST_SERVICES} - COMM_SERVICES_SANDBOX=${COMM_SERVICES_SANDBOX} - LOCALSTACK_URL=http://localstack:4566 - BLOB_SERVICE_URL=http://blob-server:50051 image: commapp/backup-server:0.1 ports: - '${COMM_SERVICES_PORT_BACKUP}:50051' volumes: - $HOME/.aws/credentials:/home/comm/.aws/credentials:ro # blob blob-server: depends_on: - localstack build: dockerfile: services/blob/Dockerfile context: ../ args: - - COMM_TEST_SERVICES=${COMM_TEST_SERVICES} - COMM_SERVICES_SANDBOX=${COMM_SERVICES_SANDBOX} image: commapp/blob-server:0.1 ports: - '${COMM_SERVICES_PORT_BLOB}:50051' volumes: - $HOME/.aws/config:/home/comm/.aws/config:ro - $HOME/.aws/credentials:/home/comm/.aws/credentials:ro # identity identity-server: depends_on: - localstack build: dockerfile: services/identity/Dockerfile context: ../ image: commapp/identity-server:0.1 ports: - '${COMM_SERVICES_PORT_IDENTITY}:50054' + # feature-flags feature-flags-server: depends_on: - localstack build: dockerfile: services/feature-flags/Dockerfile context: ../ image: commapp/feature-flags:0.1 ports: - '${COMM_SERVICES_PORT_FEATURE_FLAGS}:50051' volumes: - $HOME/.aws/config:/home/comm/.aws/config:ro - $HOME/.aws/credentials:/home/comm/.aws/credentials:ro # localstack localstack: image: localstack/localstack hostname: localstack ports: - '4566:4566' environment: - SERVICES=s3,dynamodb - DATA_DIR=/tmp/localstack - HOSTNAME_EXTERNAL=localstack volumes: - localstack:/tmp/localstack # RabbitMQ rabbitmq: image: rabbitmq:3-management hostname: rabbitmq ports: - '5672:5672' - '5671:5671' - '15672:15672' environment: - RABBITMQ_DEFAULT_USER=comm - RABBITMQ_DEFAULT_PASS=comm diff --git a/services/package.json b/services/package.json index e100b52ae..da6dc1a4c 100644 --- a/services/package.json +++ b/services/package.json @@ -1,25 +1,24 @@ { "name": "services", "version": "1.0.0", "private": true, "license": "BSD-3-Clause", "scripts": { "build-all": "docker-compose build", "run-tunnelbroker-service": "./scripts/run_server_image.sh tunnelbroker", "run-tunnelbroker-service-in-sandbox": "COMM_SERVICES_SANDBOX=1 ./scripts/run_server_image.sh tunnelbroker", "run-backup-service": "./scripts/run_server_image.sh backup", "run-backup-service-in-sandbox": "COMM_SERVICES_SANDBOX=1 ./scripts/run_server_image.sh backup", "run-blob-service": "./scripts/run_server_image.sh blob", "run-blob-service-in-sandbox": "COMM_SERVICES_SANDBOX=1 ./scripts/run_server_image.sh blob", "run-feature-flags-service": "./scripts/run_server_image.sh feature-flags", "run-feature-flags-service-in-sandbox": "COMM_SERVICES_SANDBOX=1 ./scripts/run_server_image.sh feature-flags", "run-all-services": "./scripts/run_all_services.sh", - "run-unit-tests": "./scripts/run_unit_tests.sh", "run-integration-tests": "./scripts/run_integration_tests.sh", "run-performance-tests": "./scripts/run_performance_tests.sh", "run-all-services-in-sandbox": "COMM_SERVICES_SANDBOX=1 ./scripts/run_all_services.sh", "init-local-cloud": "./scripts/init_local_cloud.sh", "delete-local-cloud": "docker-compose down -v", "reset-local-cloud": "yarn delete-local-cloud && yarn init-local-cloud" } } diff --git a/services/scripts/run_integration_tests.sh b/services/scripts/run_integration_tests.sh index 5fbb38365..1d6c8cead 100755 --- a/services/scripts/run_integration_tests.sh +++ b/services/scripts/run_integration_tests.sh @@ -1,48 +1,47 @@ #!/usr/bin/env bash set -e -export COMM_TEST_SERVICES=1 export COMM_SERVICES_SANDBOX=1 SERVICES=$(./scripts/list_services.sh) run_integration_test () { echo "integration tests tests will be run for the $1 service" # add -- --nocapture in the end to enable logs cargo test "$1"_integration_test --test '*' --manifest-path=commtest/Cargo.toml #-- --nocapture } list_expected () { echo "Expected one of these:"; echo "$SERVICES"; echo "all"; } if [[ -z "$1" ]]; then echo "No service specified"; list_expected; exit 1; fi if [[ "$1" == "all" ]]; then for SERVICE in $SERVICES; do run_integration_test "$SERVICE" done exit 0; fi; SERVICE=$(grep "$1" <<< "$SERVICES") if [[ "$SERVICE" != "$1" ]]; then echo "No such service: $1"; list_expected; exit 1; fi; set -o allexport # shellcheck source=/dev/null source .env set +o allexport run_integration_test "$SERVICE" diff --git a/services/scripts/run_unit_tests.sh b/services/scripts/run_unit_tests.sh deleted file mode 100755 index 833663c59..000000000 --- a/services/scripts/run_unit_tests.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -set -e - -export COMM_TEST_SERVICES=1 -export COMM_SERVICES_SANDBOX=1 - -SERVICES=$(./scripts/list_services.sh) - -run_unit_test () { - echo "unit tests will be run for the $1 service" - - docker-compose build "$1"-server - docker-compose run "$1"-server -} - -list_expected () { - echo "Expected one of these:"; - echo "$SERVICES"; -} - -if [[ -z "$1" ]]; then - echo "No service specified"; - list_expected; - exit 1; -fi - -if [[ "$1" == "all" ]]; then - for SERVICE in $SERVICES; do - run_unit_test "$SERVICE" - done - exit 0; -fi; - -SERVICE=$(grep "$1" <<< "$SERVICES") - -if [[ "$SERVICE" != "$1" ]]; then - echo "No such service: $1"; - list_expected; - exit 1; -fi; - -run_unit_test "$SERVICE" diff --git a/services/terraform/dynamodb-test.tf b/services/terraform/dynamodb-test.tf deleted file mode 100644 index 15407c19e..000000000 --- a/services/terraform/dynamodb-test.tf +++ /dev/null @@ -1,104 +0,0 @@ -resource "aws_dynamodb_table" "backup-service-backup-test" { - name = "backup-service-backup-test" - hash_key = "userID" - range_key = "backupID" - write_capacity = 10 - read_capacity = 10 - - attribute { - name = "userID" - type = "S" - } - - attribute { - name = "backupID" - type = "S" - } - - attribute { - name = "created" - type = "S" - } - - global_secondary_index { - name = "userID-created-index" - hash_key = "userID" - range_key = "created" - write_capacity = 10 - read_capacity = 10 - projection_type = "INCLUDE" - non_key_attributes = ["recoveryData"] - } -} - -resource "aws_dynamodb_table" "backup-service-log-test" { - name = "backup-service-log-test" - hash_key = "backupID" - range_key = "logID" - write_capacity = 10 - read_capacity = 10 - - attribute { - name = "backupID" - type = "S" - } - - attribute { - name = "logID" - type = "S" - } -} - -resource "aws_dynamodb_table" "blob-service-blob-test" { - name = "blob-service-blob-test" - hash_key = "blobHash" - write_capacity = 10 - read_capacity = 10 - - attribute { - name = "blobHash" - type = "S" - } -} - -resource "aws_dynamodb_table" "blob-service-reverse-index-test" { - name = "blob-service-reverse-index-test" - hash_key = "holder" - write_capacity = 10 - read_capacity = 10 - - attribute { - name = "holder" - type = "S" - } - - attribute { - name = "blobHash" - type = "S" - } - - global_secondary_index { - name = "blobHash-index" - hash_key = "blobHash" - write_capacity = 10 - read_capacity = 10 - projection_type = "ALL" - } -} - -resource "aws_dynamodb_table" "feature-flags-test" { - name = "feature-flags-test" - hash_key = "platform" - range_key = "feature" - billing_mode = "PAY_PER_REQUEST" - - attribute { - name = "platform" - type = "S" - } - - attribute { - name = "feature" - type = "S" - } -}