diff --git a/.DS_Store b/.DS_Store index bb353de98..24594602d 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 4d88ba336..79cf6743b 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -9,22 +9,22 @@ concurrency: cancel-in-progress: true jobs: - # # https://github.com/bcgov-nr/action-builder-ghcr - # builds: - # name: Builds - # runs-on: ubuntu-22.04 - # strategy: - # matrix: - # package: [backend, frontend, migrations] - # timeout-minutes: 10 - # steps: - # - uses: bcgov-nr/action-builder-ghcr@v2.0.2 - # with: - # keep_versions: 50 - # package: ${{ matrix.package }} - # tag: ${{ github.event.number }} - # tag_fallback: latest - # triggers: ('${{ matrix.package }}/') + # https://github.com/bcgov-nr/action-builder-ghcr + builds: + name: Builds + runs-on: ubuntu-22.04 + strategy: + matrix: + package: [backend] + timeout-minutes: 10 + steps: + - uses: bcgov-nr/action-builder-ghcr@v2.0.2 + with: + keep_versions: 50 + package: ${{ matrix.package }} + tag: ${{ github.event.number }} + tag_fallback: latest + triggers: ('${{ matrix.package }}/') # # https://github.com/bcgov/quickstart-openshift-helpers # deploys: diff --git a/backend/.dockerignore b/backend/.dockerignore new file mode 100644 index 000000000..40b989b1f --- /dev/null +++ b/backend/.dockerignore @@ -0,0 +1,24 @@ +# Standard exclusions +*.md +.git +.github +.idea +.vscode +Dockerfile +CODE_OF_CONDUCT* +CONTRIBUTING* +LICENSE* +SECURITY* + +# Node exclusions +dist +node_modules +npm-debug.log + +# App-specific exclusions +# coverage +# e2e +# migrations +# output +# test +# tests \ No newline at end of file diff --git a/gwells/database/README.md b/database/README.md similarity index 100% rename from gwells/database/README.md rename to database/README.md diff --git a/gwells/database/codetables/registries/data-load-migrate.sql b/database/codetables/registries/data-load-migrate.sql similarity index 100% rename from gwells/database/codetables/registries/data-load-migrate.sql rename to database/codetables/registries/data-load-migrate.sql diff --git a/gwells/database/codetables/wellsubmission/README.md b/database/codetables/wellsubmission/README.md similarity index 100% rename from gwells/database/codetables/wellsubmission/README.md rename to database/codetables/wellsubmission/README.md diff --git a/gwells/database/codetables/wellsubmission/data-load-static-codes.sql b/database/codetables/wellsubmission/data-load-static-codes.sql similarity index 100% rename from gwells/database/codetables/wellsubmission/data-load-static-codes.sql rename to database/codetables/wellsubmission/data-load-static-codes.sql diff --git a/gwells/database/codetables/wellsubmission/pending-decision.xform_gwells_surface_seal_material.csv b/database/codetables/wellsubmission/pending-decision.xform_gwells_surface_seal_material.csv similarity index 100% rename from gwells/database/codetables/wellsubmission/pending-decision.xform_gwells_surface_seal_material.csv rename to database/codetables/wellsubmission/pending-decision.xform_gwells_surface_seal_material.csv diff --git a/gwells/database/scripts/aquifers/initialize-xforms-aquifers.sql b/database/scripts/aquifers/initialize-xforms-aquifers.sql similarity index 100% rename from gwells/database/scripts/aquifers/initialize-xforms-aquifers.sql rename to database/scripts/aquifers/initialize-xforms-aquifers.sql diff --git a/gwells/database/scripts/aquifers/xforms-aquifers.csv b/database/scripts/aquifers/xforms-aquifers.csv similarity index 100% rename from gwells/database/scripts/aquifers/xforms-aquifers.csv rename to database/scripts/aquifers/xforms-aquifers.csv diff --git a/gwells/database/scripts/local_dev/setup.sql b/database/scripts/local_dev/setup.sql similarity index 100% rename from gwells/database/scripts/local_dev/setup.sql rename to database/scripts/local_dev/setup.sql diff --git a/gwells/database/scripts/registries/initialize-xforms-registries.sql b/database/scripts/registries/initialize-xforms-registries.sql similarity index 100% rename from gwells/database/scripts/registries/initialize-xforms-registries.sql rename to database/scripts/registries/initialize-xforms-registries.sql diff --git a/gwells/database/scripts/registries/populate-registries-from-xform.sql b/database/scripts/registries/populate-registries-from-xform.sql similarity index 100% rename from gwells/database/scripts/registries/populate-registries-from-xform.sql rename to database/scripts/registries/populate-registries-from-xform.sql diff --git a/gwells/database/scripts/registries/populate-xforms-registries.sql b/database/scripts/registries/populate-xforms-registries.sql similarity index 100% rename from gwells/database/scripts/registries/populate-xforms-registries.sql rename to database/scripts/registries/populate-xforms-registries.sql diff --git a/gwells/database/scripts/registries/post-deploy.sql b/database/scripts/registries/post-deploy.sql similarity index 100% rename from gwells/database/scripts/registries/post-deploy.sql rename to database/scripts/registries/post-deploy.sql diff --git a/gwells/database/scripts/sql-developer/user-defined-reports/report_export.xml b/database/scripts/sql-developer/user-defined-reports/report_export.xml similarity index 100% rename from gwells/database/scripts/sql-developer/user-defined-reports/report_export.xml rename to database/scripts/sql-developer/user-defined-reports/report_export.xml diff --git a/gwells/database/scripts/sql-developer/user-defined-reports/wells_data_analysis.xml b/database/scripts/sql-developer/user-defined-reports/wells_data_analysis.xml similarity index 100% rename from gwells/database/scripts/sql-developer/user-defined-reports/wells_data_analysis.xml rename to database/scripts/sql-developer/user-defined-reports/wells_data_analysis.xml diff --git a/gwells/database/scripts/sql-developer/wells_data_analysis.xml b/database/scripts/sql-developer/wells_data_analysis.xml similarity index 100% rename from gwells/database/scripts/sql-developer/wells_data_analysis.xml rename to database/scripts/sql-developer/wells_data_analysis.xml diff --git a/gwells/database/scripts/sql-developer/xform-legacy-data.sql b/database/scripts/sql-developer/xform-legacy-data.sql similarity index 100% rename from gwells/database/scripts/sql-developer/xform-legacy-data.sql rename to database/scripts/sql-developer/xform-legacy-data.sql diff --git a/gwells/database/scripts/wellsearch/post-deploy.sql b/database/scripts/wellsearch/post-deploy.sql similarity index 100% rename from gwells/database/scripts/wellsearch/post-deploy.sql rename to database/scripts/wellsearch/post-deploy.sql diff --git a/docker-compose.yml b/docker-compose.yml index 324b316f6..7a6a864e8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -76,7 +76,7 @@ services: volumes: - pgdata-volume:/pgdata:z - type: bind - source: ./app/database/scripts/local_dev/setup.sql + source: ./database/scripts/local_dev/setup.sql target: /pgconf/setup.sql consistency: cached healthcheck: @@ -141,8 +141,8 @@ services: backend: platform: linux/x86_64 build: - context: ./openshift/docker/backend - dockerfile: Dockerfile.dev + context: ./backend + dockerfile: Dockerfile hostname: backend env_file: - path: ./.env.test @@ -197,12 +197,12 @@ services: command: ./scripts/backend-command-script.sh volumes: - type: bind - source: ./app/backend - target: /app/backend + source: ./backend + target: /backend consistency: cached - type: bind - source: ./app/scripts/backend-command-script.sh - target: /app/scripts/backend-command-script.sh + source: ./scripts/backend-command-script.sh + target: /scripts/backend-command-script.sh consistency: cached ports: - "8000:8000" diff --git a/gwells/tests/api-tests/files/square-shapefile.zip b/gwells/tests/api-tests/files/square-shapefile.zip deleted file mode 100755 index e4c782fe3..000000000 Binary files a/gwells/tests/api-tests/files/square-shapefile.zip and /dev/null differ diff --git a/gwells/scripts/backend-command-script.sh b/scripts/backend-command-script.sh similarity index 100% rename from gwells/scripts/backend-command-script.sh rename to scripts/backend-command-script.sh diff --git a/gwells/scripts/copy-keycloak-roles.py b/scripts/copy-keycloak-roles.py similarity index 100% rename from gwells/scripts/copy-keycloak-roles.py rename to scripts/copy-keycloak-roles.py diff --git a/gwells/scripts/download-aquifer-pdfs.py b/scripts/download-aquifer-pdfs.py similarity index 100% rename from gwells/scripts/download-aquifer-pdfs.py rename to scripts/download-aquifer-pdfs.py diff --git a/gwells/scripts/gwells-app.sh b/scripts/gwells-app.sh similarity index 100% rename from gwells/scripts/gwells-app.sh rename to scripts/gwells-app.sh diff --git a/gwells/scripts/gwells-deploy.sh b/scripts/gwells-deploy.sh similarity index 100% rename from gwells/scripts/gwells-deploy.sh rename to scripts/gwells-deploy.sh diff --git a/gwells/scripts/pre-deploy.sh b/scripts/pre-deploy.sh similarity index 100% rename from gwells/scripts/pre-deploy.sh rename to scripts/pre-deploy.sh diff --git a/gwells/scripts/profanitysearch/README.md b/scripts/profanitysearch/README.md similarity index 100% rename from gwells/scripts/profanitysearch/README.md rename to scripts/profanitysearch/README.md diff --git a/gwells/scripts/profanitysearch/profanity.py b/scripts/profanitysearch/profanity.py similarity index 100% rename from gwells/scripts/profanitysearch/profanity.py rename to scripts/profanitysearch/profanity.py diff --git a/gwells/scripts/profanitysearch/requirements.txt b/scripts/profanitysearch/requirements.txt similarity index 100% rename from gwells/scripts/profanitysearch/requirements.txt rename to scripts/profanitysearch/requirements.txt diff --git a/gwells/scripts/qaqc/README.md b/scripts/qaqc/README.md similarity index 100% rename from gwells/scripts/qaqc/README.md rename to scripts/qaqc/README.md diff --git a/gwells/scripts/qaqc/extract_data.py b/scripts/qaqc/extract_data.py similarity index 100% rename from gwells/scripts/qaqc/extract_data.py rename to scripts/qaqc/extract_data.py diff --git a/gwells/scripts/qaqc/get_esa_worldcover_bc.sh b/scripts/qaqc/get_esa_worldcover_bc.sh similarity index 100% rename from gwells/scripts/qaqc/get_esa_worldcover_bc.sh rename to scripts/qaqc/get_esa_worldcover_bc.sh diff --git a/gwells/scripts/qaqc/gwells_locationqa.py b/scripts/qaqc/gwells_locationqa.py similarity index 100% rename from gwells/scripts/qaqc/gwells_locationqa.py rename to scripts/qaqc/gwells_locationqa.py diff --git a/gwells/scripts/qaqc/requirements.txt b/scripts/qaqc/requirements.txt similarity index 100% rename from gwells/scripts/qaqc/requirements.txt rename to scripts/qaqc/requirements.txt diff --git a/gwells/scripts/run-in-container.sh b/scripts/run-in-container.sh similarity index 100% rename from gwells/scripts/run-in-container.sh rename to scripts/run-in-container.sh diff --git a/gwells/scripts/update-drinking-water-wtn.py b/scripts/update-drinking-water-wtn.py similarity index 100% rename from gwells/scripts/update-drinking-water-wtn.py rename to scripts/update-drinking-water-wtn.py diff --git a/gwells/tests/api-tests/.envrc b/tests/api-tests/.envrc similarity index 100% rename from gwells/tests/api-tests/.envrc rename to tests/api-tests/.envrc diff --git a/gwells/tests/api-tests/README.md b/tests/api-tests/README.md similarity index 100% rename from gwells/tests/api-tests/README.md rename to tests/api-tests/README.md diff --git a/gwells/tests/api-tests/aquifers_api_tests.json b/tests/api-tests/aquifers_api_tests.json similarity index 100% rename from gwells/tests/api-tests/aquifers_api_tests.json rename to tests/api-tests/aquifers_api_tests.json diff --git a/gwells/tests/api-tests/aquifers_v2_api_tests.json b/tests/api-tests/aquifers_v2_api_tests.json similarity index 100% rename from gwells/tests/api-tests/aquifers_v2_api_tests.json rename to tests/api-tests/aquifers_v2_api_tests.json diff --git a/gwells/tests/api-tests/cities_api_tests.json b/tests/api-tests/cities_api_tests.json similarity index 100% rename from gwells/tests/api-tests/cities_api_tests.json rename to tests/api-tests/cities_api_tests.json diff --git a/gwells/tests/api-tests/configuration_api_tests.json b/tests/api-tests/configuration_api_tests.json similarity index 100% rename from gwells/tests/api-tests/configuration_api_tests.json rename to tests/api-tests/configuration_api_tests.json diff --git a/gwells/tests/api-tests/exports_api_tests.json b/tests/api-tests/exports_api_tests.json similarity index 100% rename from gwells/tests/api-tests/exports_api_tests.json rename to tests/api-tests/exports_api_tests.json diff --git a/gwells/tests/api-tests/local_aquifers.sh b/tests/api-tests/local_aquifers.sh similarity index 100% rename from gwells/tests/api-tests/local_aquifers.sh rename to tests/api-tests/local_aquifers.sh diff --git a/gwells/tests/api-tests/local_configurations.sh b/tests/api-tests/local_configurations.sh similarity index 100% rename from gwells/tests/api-tests/local_configurations.sh rename to tests/api-tests/local_configurations.sh diff --git a/gwells/tests/api-tests/local_exports_utilities.sh b/tests/api-tests/local_exports_utilities.sh similarity index 100% rename from gwells/tests/api-tests/local_exports_utilities.sh rename to tests/api-tests/local_exports_utilities.sh diff --git a/gwells/tests/api-tests/local_registries.sh b/tests/api-tests/local_registries.sh similarity index 100% rename from gwells/tests/api-tests/local_registries.sh rename to tests/api-tests/local_registries.sh diff --git a/gwells/tests/api-tests/local_run_all.sh b/tests/api-tests/local_run_all.sh similarity index 100% rename from gwells/tests/api-tests/local_run_all.sh rename to tests/api-tests/local_run_all.sh diff --git a/gwells/tests/api-tests/local_submissions.sh b/tests/api-tests/local_submissions.sh similarity index 100% rename from gwells/tests/api-tests/local_submissions.sh rename to tests/api-tests/local_submissions.sh diff --git a/gwells/tests/api-tests/local_wells.sh b/tests/api-tests/local_wells.sh similarity index 100% rename from gwells/tests/api-tests/local_wells.sh rename to tests/api-tests/local_wells.sh diff --git a/gwells/tests/api-tests/local_wells_search.sh b/tests/api-tests/local_wells_search.sh similarity index 100% rename from gwells/tests/api-tests/local_wells_search.sh rename to tests/api-tests/local_wells_search.sh diff --git a/gwells/tests/api-tests/registries_api_tests.json b/tests/api-tests/registries_api_tests.json similarity index 100% rename from gwells/tests/api-tests/registries_api_tests.json rename to tests/api-tests/registries_api_tests.json diff --git a/gwells/tests/api-tests/registries_v2_api_tests.json b/tests/api-tests/registries_v2_api_tests.json similarity index 100% rename from gwells/tests/api-tests/registries_v2_api_tests.json rename to tests/api-tests/registries_v2_api_tests.json diff --git a/gwells/tests/api-tests/submissions_api_tests.json b/tests/api-tests/submissions_api_tests.json similarity index 100% rename from gwells/tests/api-tests/submissions_api_tests.json rename to tests/api-tests/submissions_api_tests.json diff --git a/gwells/tests/api-tests/submissions_v2_api_tests.json b/tests/api-tests/submissions_v2_api_tests.json similarity index 100% rename from gwells/tests/api-tests/submissions_v2_api_tests.json rename to tests/api-tests/submissions_v2_api_tests.json diff --git a/gwells/tests/api-tests/utilities_api_tests.json b/tests/api-tests/utilities_api_tests.json similarity index 100% rename from gwells/tests/api-tests/utilities_api_tests.json rename to tests/api-tests/utilities_api_tests.json diff --git a/gwells/tests/api-tests/wells_api_tests.json b/tests/api-tests/wells_api_tests.json similarity index 100% rename from gwells/tests/api-tests/wells_api_tests.json rename to tests/api-tests/wells_api_tests.json diff --git a/gwells/tests/api-tests/wells_search_api_tests.json b/tests/api-tests/wells_search_api_tests.json similarity index 100% rename from gwells/tests/api-tests/wells_search_api_tests.json rename to tests/api-tests/wells_search_api_tests.json diff --git a/gwells/tests/api-tests/wells_search_v2_api_tests.json b/tests/api-tests/wells_search_v2_api_tests.json similarity index 100% rename from gwells/tests/api-tests/wells_search_v2_api_tests.json rename to tests/api-tests/wells_search_v2_api_tests.json diff --git a/gwells/tests/api-tests/wells_v2_api_tests.json b/tests/api-tests/wells_v2_api_tests.json similarity index 100% rename from gwells/tests/api-tests/wells_v2_api_tests.json rename to tests/api-tests/wells_v2_api_tests.json diff --git a/tests/integration/package-lock.json b/tests/integration/package-lock.json deleted file mode 100644 index 4ff39047c..000000000 --- a/tests/integration/package-lock.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "name": "integration-tests", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "integration-tests", - "version": "1.0.0", - "dependencies": { - "axios": "^1.6.8", - "dotenv": "^16.3.1", - "js-yaml": "^4.1.0", - "lodash": "^4.17.21" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/axios": { - "version": "1.6.8", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", - "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", - "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/dotenv": { - "version": "16.3.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", - "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/motdotla/dotenv?sponsor=1" - } - }, - "node_modules/follow-redirects": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - } - } -} diff --git a/tests/integration/package.json b/tests/integration/package.json deleted file mode 100644 index 32cd584ef..000000000 --- a/tests/integration/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "integration-tests", - "version": "1.0.0", - "type": "module", - "main": "src/main.js", - "scripts": { - "dev": "node src/main.js" - }, - "dependencies": { - "axios": "^1.6.8", - "dotenv": "^16.3.1", - "js-yaml": "^4.1.0", - "lodash": "^4.17.21" - } -} diff --git a/tests/integration/src/main.js b/tests/integration/src/main.js deleted file mode 100644 index 498198e11..000000000 --- a/tests/integration/src/main.js +++ /dev/null @@ -1,94 +0,0 @@ -import dotenv from "dotenv"; -import axios from "axios"; -import * as fs from "fs"; -import * as path from "path"; -import { fileURLToPath } from "url"; -import assert from "node:assert/strict"; - -import pkg from "lodash"; - -dotenv.config(); - -const { isEqual, omit } = pkg; - -const __filename = fileURLToPath(import.meta.url); - -const __dirname = path.dirname(__filename); -const apiName = process.env.API_NAME; -const BASE_URL = process.env.BASE_URL; - -async function performEachMethod(BASE_URL, testCase, method, id) { - let url = BASE_URL + testCase.path; - if (id && (method === "GET" || method === "PUT" || method === "PATCH" || method === "DELETE")) { - if (url.endsWith("/") === false) { - url = url + "/" + id; - } else { - url = url + id; - } - } - let payload; - if (method === "POST") { - payload = testCase.data?.post_payload; - } else if (method === "PUT") { - payload = testCase.data?.put_payload; - } else if (method === "PATCH") { - payload = testCase.data?.patch_payload; - } - const response = await axios({ - method: method, - url: url, - headers: { - ...testCase.headers - }, - data: payload - }); - console.info(`Response for ${method} ${url} : ${response.status}`); - const methodAssertion = testCase.assertions.find(assertion => assertion.method === method); - const responseData = response.data?.data || response.data; - if (methodAssertion) { - if (methodAssertion.status_code) { - assert(response.status === methodAssertion.status_code); - } - if (methodAssertion.body) { - assert(isEqual(omit(responseData, testCase.data.id_field), methodAssertion.body) === true); - } - } - if (method === "POST") { - return responseData[testCase.data.id_field]; - } -} - -async function performTesting(testSuitesDir, testSuiteFile) { - console.info(`Running test suite for : ${testSuiteFile}`); - const testSuitePath = path.join(testSuitesDir, testSuiteFile); - const testSuite = JSON.parse(await fs.promises.readFile(testSuitePath, "utf-8")); - for (const testCase of testSuite.tests) { - let id = null; - for (const method of testCase.methods) { - const responseId = await performEachMethod(BASE_URL, testCase, method, id); - if (responseId) { - id = responseId; - } - } - } -} - -const main = async () => { - const testSuitesDir = path.join(__dirname, "test_suites"); - const testSuiteFiles = await fs.promises.readdir(testSuitesDir); - const testFile = testSuiteFiles.find(file => file.includes(apiName)); - await performTesting(testSuitesDir, testFile); -}; - -try { - await main(); -} catch (e) { - if (e instanceof assert.AssertionError) { - console.error(e); - process.exit(137); - } - console.error(e); - process.exit(137); -} - - diff --git a/tests/integration/src/test_suites/it.backend.fastapi.json b/tests/integration/src/test_suites/it.backend.fastapi.json deleted file mode 100644 index 0771844c6..000000000 --- a/tests/integration/src/test_suites/it.backend.fastapi.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "api_name": "fastapi", - "api_version": "1.0.0", - "base_url": "${BASE_URL}", - "tests": [ - { - "name": "User Endpoint TEST", - "methods": [ - "GET", - "POST", - "GET", - "DELETE" - ], - "path": "/api/v1/user/", - "headers": { - "Content-Type": "application/json", - "accept": "application/json" - }, - "data": { - "id_field": "user_id", - "post_payload": { - "name": "John", - "email": "John.ipsum@test.com" - }, - "put_payload": { - "name": "Jane", - "email": "Jane.ipsum@test.com" - }, - "patch_payload": { - "name": "Jane", - "email": "Jane.ipsum@test.com" - } - }, - "assertions": [ - { - "method": "POST", - "status_code": 200, - "body": { - "name": "John", - "email": "John.ipsum@test.com" - } - }, - { - "method": "GET", - "status_code": 200 - }, - { - "method": "PUT", - "status_code": 200, - "body": { - "name": "Jane", - "email": "Jane.ipsum@test.com" - } - }, - { - "method": "DELETE", - "status_code": 200 - } - ] - } - ] -} diff --git a/tests/integration/src/test_suites/it.backend.fiber.json b/tests/integration/src/test_suites/it.backend.fiber.json deleted file mode 100644 index fa7ba86b4..000000000 --- a/tests/integration/src/test_suites/it.backend.fiber.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "api_name": "fiber", - "api_version": "1.0.0", - "base_url": "${BASE_URL}", - "tests": [ - { - "name": "User Endpoint TEST", - "methods": [ - "GET", - "POST", - "PUT", - "GET", - "DELETE" - ], - "path": "/api/v1/users", - "headers": { - "Content-Type": "application/json" - }, - "data": { - "id_field": "id", - "post_payload": { - "name": "John", - "email": "John.ipsum@test.com", - "addresses": [ - ] - }, - "put_payload": { - "name": "Jane", - "email": "Jane.ipsum@test.com", - "addresses": [ - ] - }, - "patch_payload": { - "name": "Jane", - "email": "Jane.ipsum@test.com" - } - }, - "assertions": [ - { - "method": "POST", - "status_code": 201, - "body": { - "name": "John", - "email": "John.ipsum@test.com", - "addresses": null - } - }, - { - "method": "GET", - "status_code": 200 - }, - { - "method": "PUT", - "status_code": 200, - "body": { - "name": "Jane", - "email": "Jane.ipsum@test.com", - "addresses": null - } - }, - { - "method": "DELETE", - "status_code": 204 - } - ] - } - ] -} diff --git a/tests/integration/src/test_suites/it.backend.nest.json b/tests/integration/src/test_suites/it.backend.nest.json deleted file mode 100644 index da0d89c52..000000000 --- a/tests/integration/src/test_suites/it.backend.nest.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "api_name": "nest", - "api_version": "1.0.0", - "base_url": "${BASE_URL}", - "tests": [ - { - "name": "User Endpoint TEST", - "methods": [ - "GET", - "POST", - "PUT", - "GET", - "DELETE" - ], - "path": "/api/v1/users", - "headers": { - "Content-Type": "application/json" - }, - "data": { - "id_field": "id", - "post_payload": { - "name": "John", - "email": "John.ipsum@test.com" - }, - "put_payload": { - "name": "Jane", - "email": "Jane.ipsum@test.com" - }, - "patch_payload": { - "name": "Jane", - "email": "Jane.ipsum@test.com" - } - }, - "assertions": [ - { - "method": "POST", - "status_code": 201, - "body": { - "name": "John", - "email": "John.ipsum@test.com" - } - }, - { - "method": "GET", - "status_code": 200 - }, - { - "method": "PUT", - "status_code": 200, - "body": { - "name": "Jane", - "email": "Jane.ipsum@test.com" - } - }, - { - "method": "DELETE", - "status_code": 200 - } - ] - } - ] -} diff --git a/tests/integration/src/test_suites/it.backend.quarkus.json b/tests/integration/src/test_suites/it.backend.quarkus.json deleted file mode 100644 index a7c9b6b57..000000000 --- a/tests/integration/src/test_suites/it.backend.quarkus.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "api_name": "nest", - "api_version": "1.0.0", - "base_url": "${BASE_URL}", - "tests": [ - { - "name": "User Endpoint TEST", - "methods": [ - "GET", - "POST", - "PUT", - "GET", - "DELETE" - ], - "path": "/api/v1/users", - "headers": { - "Content-Type": "application/json" - }, - "data": { - "id_field": "id", - "post_payload": { - "name": "John", - "email": "John.ipsum@test.com" - }, - "put_payload": { - "name": "Jane", - "email": "Jane.ipsum@test.com" - }, - "patch_payload": { - "name": "Jane", - "email": "Jane.ipsum@test.com" - } - }, - "assertions": [ - { - "method": "POST", - "status_code": 201, - "body": { - "name": "John", - "email": "John.ipsum@test.com" - } - }, - { - "method": "GET", - "status_code": 200 - }, - { - "method": "PUT", - "status_code": 200, - "body": { - "name": "Jane", - "email": "Jane.ipsum@test.com" - } - }, - { - "method": "DELETE", - "status_code": 204 - } - ] - } - ] -} diff --git a/tests/load/README.md b/tests/load/README.md deleted file mode 100644 index d2fe3d4e2..000000000 --- a/tests/load/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# This Directory contains the load test scripts for the project. -## The scripts are written in JS and use the k6 framework. [k6](https://k6.io) - -1. The Tests are samples, dev teams are encouraged to write their own tests based on the use cases of their project. -2. The tests are run using GitHub Actions. - -# Please inform platform services team if you would do a HUGE load TEST on OpenShift platform as it impacts the platform performance. -``` diff --git a/tests/load/backend-test.js b/tests/load/backend-test.js deleted file mode 100644 index 31c11ca8b..000000000 --- a/tests/load/backend-test.js +++ /dev/null @@ -1,34 +0,0 @@ -import { check } from "k6"; -import * as http from "k6/http"; -import { Rate } from "k6/metrics"; - - -export let errorRate = new Rate("errors"); - - -function checkStatus(response, checkName, statusCode = 200) { - let success = check(response, { - [checkName]: (r) => { - if (r.status === statusCode) { - return true; - } else { - console.error(checkName + " failed. Incorrect response code." + r.status); - return false; - } - } - }); - errorRate.add(!success, { tag1: checkName }); -} - - -export default function(token) { - let url = `${__ENV.BACKEND_URL}/v1/users`; - let params = { - headers: { - "Content-Type": "application/json" - } - }; - let res = http.get(url, params); - checkStatus(res, "get-all-users", 200); - -} diff --git a/tests/load/frontend-test.js b/tests/load/frontend-test.js deleted file mode 100644 index ecd24a46f..000000000 --- a/tests/load/frontend-test.js +++ /dev/null @@ -1,30 +0,0 @@ -import { check } from "k6"; -import * as http from "k6/http"; -import { Rate } from "k6/metrics"; - - -export let errorRate = new Rate("errors"); - - -function checkStatus(response, checkName, statusCode = 200) { - let success = check(response, { - [checkName]: (r) => { - if (r.status === statusCode) { - return true; - } else { - console.error(checkName + " failed. Incorrect response code." + r.status); - return false; - } - } - }); - errorRate.add(!success, { tag1: checkName }); -} - - -export default function(token) { - let url = `${__ENV.FRONTEND_URL}`; - - let res = http.get(url); - checkStatus(res, "frontend", 200); - -} diff --git a/gwells/tests/zap/README.md b/tests/zap/README.md similarity index 100% rename from gwells/tests/zap/README.md rename to tests/zap/README.md diff --git a/gwells/tests/zap/runzap.sh b/tests/zap/runzap.sh similarity index 100% rename from gwells/tests/zap/runzap.sh rename to tests/zap/runzap.sh