Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/aps-cypress-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- name: Build GWA API Image
run: |
git clone https://github.com/bcgov/gwa-api.git --branch v1.0.40
git clone https://github.com/bcgov/gwa-api.git --branch v1.0.47
cd gwa-api/microservices/gatewayApi
docker build -t gwa-api:e2e .

Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/ci-feat-sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ jobs:
with:
fetch-depth: 0

- name: Install deps
run: |
sudo apt update

- uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '22'

- name: Run Tests
run: |
Expand All @@ -36,7 +40,7 @@ jobs:

cd src

npm i
npm i --legacy-peer-deps
npm run intg-build
npm test

Expand All @@ -45,13 +49,6 @@ jobs:

- name: SonarCloud Scan
uses: sonarsource/sonarqube-scan-action@master
with:
args: >
-Dsonar.organization=bcgov-oss
-Dsonar.projectKey=aps-portal
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.sources=src/auth,src/authz,src/batch,src/services
-Dsonar.javascript.lcov.reportPaths=./src/__coverage__/lcov.info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ Use the following configuration to run the Portal locally (outside of Docker) ag
1. Start the OAuth2 Proxy locally:

```sh
# mac
hostip=$(ifconfig en0 | awk '$1 == "inet" {print $2}')

# WSL
hostip=$(hostname -I | awk '{print $1}')

docker run -ti --rm --name proxy --net=host \
--add-host portal.localtest.me:$hostip \
-v `pwd`/local/oauth2-proxy/oauth2-proxy-dev.yaml:/oauth2.yaml \
Expand Down
39 changes: 23 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

x-common-variables: &common-variables
KONG_DATABASE: postgres
KONG_PG_DATABASE: kong
Expand All @@ -13,7 +11,8 @@ services:
container_name: keycloak
hostname: keycloak
depends_on:
- kong-db
kong-db:
condition: service_healthy
command:
[
'-b',
Expand Down Expand Up @@ -103,7 +102,7 @@ services:
networks:
- aps-net
kong-db:
image: postgres:12.8
image: postgres:14
container_name: kong-db
environment:
POSTGRES_USER: postgres
Expand All @@ -115,13 +114,19 @@ services:
volumes:
- ./local/db/database-init.sql:/docker-entrypoint-initdb.d/1-init.sql
- ./local/db/keystone-init.sql:/docker-entrypoint-initdb.d/2-init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 10
networks:
- aps-net
kong-migrations:
image: kong:kong-local
command: kong migrations bootstrap
depends_on:
- kong-db
kong-db:
condition: service_healthy
environment:
<<: *common-variables
KONG_DNS_ORDER: 'LAST,A'
Expand All @@ -135,8 +140,10 @@ services:
image: kong:kong-local
command: kong migrations up && kong migrations finish
depends_on:
- kong-db
- kong-migrations
kong-db:
condition: service_healthy
kong-migrations:
condition: service_completed_successfully
environment:
<<: *common-variables
KONG_DNS_ORDER: 'LAST,A'
Expand Down Expand Up @@ -216,15 +223,15 @@ services:
entrypoint: sh -c "chmod +x /tmp/entrypoint.sh && /tmp/entrypoint.sh"
environment:
- BROWSER=edge
- CYPRESS_RECORD_KEY=${CY_RECORD_KEY}
- CYPRESS_PROJECT_ID=${CY_PROJECT_ID}
- RUN_ENV=${CY_EXECUTION_ENV}
- COMMIT_INFO_BRANCH=${CY_COMMIT_BRANCH}
- COMMIT_INFO_SHA=${CY_COMMIT_SHA}
- COMMIT_INFO_AUTHOR=${CY_COMMIT_AUTHOR}
- COMMIT_INFO_MESSAGE=${CY_COMMIT_MESSAGE}
- COMMIT_INFO_REMOTE=${CY_REPO_URL}
- COMMIT_INFO_EMAIL=${CY_COMMIT_AUTHOR_EMAIL}
- CYPRESS_RECORD_KEY=${CY_RECORD_KEY:-}
- CYPRESS_PROJECT_ID=${CY_PROJECT_ID:-}
- RUN_ENV=${CY_EXECUTION_ENV:-}
- COMMIT_INFO_BRANCH=${CY_COMMIT_BRANCH:-}
- COMMIT_INFO_SHA=${CY_COMMIT_SHA:-}
- COMMIT_INFO_AUTHOR=${CY_COMMIT_AUTHOR:-}
- COMMIT_INFO_MESSAGE=${CY_COMMIT_MESSAGE:-}
- COMMIT_INFO_REMOTE=${CY_REPO_URL:-}
- COMMIT_INFO_EMAIL=${CY_COMMIT_AUTHOR_EMAIL:-}
depends_on:
- feeder-seeding
build:
Expand Down
4 changes: 2 additions & 2 deletions e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM cypress/included:12.17.4
FROM cypress/included:13.17.0

# Copy of the source for code coverage analysis
WORKDIR /app
Expand All @@ -22,7 +22,7 @@ COPY e2e/*.yml /e2e
COPY e2e/entrypoint.sh /tmp
ADD e2e/cypress /e2e/cypress

RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v3.0.5/gwa_Linux_x86_64.tgz \
RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v3.0.6/gwa_Linux_x86_64.tgz \
&& tar -xzf gwa_Linux_x86_64.tgz \
&& mv gwa /usr/local/bin/.

Expand Down
11 changes: 9 additions & 2 deletions e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export default defineConfig({
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
require('dotenv').config()
require('@cypress/code-coverage/task')(on, config)
// Only enable code coverage in CI or when explicitly enabled
if (process.env.CI || process.env.ENABLE_COVERAGE === 'true') {
require('@cypress/code-coverage/task')(on, config)
}

// // It's IMPORTANT to return the config object
// // with any changed environment variables
Expand All @@ -26,7 +29,7 @@ export default defineConfig({
'./cypress/tests/07-*/*.ts',
'./cypress/tests/03-*/*.ts',
'./cypress/tests/04-*/*.ts',
// './cypress/tests/05-*/*.ts',
'./cypress/tests/05-*/*.ts',
'./cypress/tests/08-*/*.ts',
'./cypress/tests/09-*/*.ts',
'./cypress/tests/10-*/*.ts',
Expand Down Expand Up @@ -74,6 +77,10 @@ export default defineConfig({
WEBAPP_URL: 'http://html-sample-app.localtest.me:4242',
DEV_USERNAME: 'janis@idir',
DEV_PASSWORD: 'awsummer',
HAS_KUBE_API: false,
// Pass CI flag to browser context for code coverage
CI: process.env.CI || false,
ENABLE_COVERAGE: process.env.ENABLE_COVERAGE || false,
},
retries: {
runMode: 2,
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/cc-service-gwa.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: cc-service-for-platform
host: httpbin.org
host: httpbun.com
tags: [ns.ccplatform]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/cc-service.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: cc-service-for-platform
host: httpbin.org
host: httpbun.com
tags: [ns.ccplatform]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/org-service.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: a-service-for-orgassignment
host: httpbin.org
host: httpbun.com
tags: [ns.orgassignment]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/service-api.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: service-for-apiplatform
host: httpbin.org
host: httpbun.com
tags: [ns.apiplatform]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/service-availability.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kind: GatewayService
name: taken-service-name
host: httpbin.org
host: httpbun.com
tags: [ns.service-avail]
port: 446
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/service-clear-resources-gwa.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: service-for-deleteplatform
host: httpbin.org
host: httpbun.com
tags: [ns.deleteplatform]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/service-clear-resources.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: service-for-deleteplatform
host: httpbin.org
host: httpbun.com
tags: [ns.deleteplatform]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/service-dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: a-service-for-newplatform
host: httpbin.org
host: httpbun.com
tags: [ns.newplatform]
port: 443
protocol: https
Expand Down
4 changes: 2 additions & 2 deletions e2e/cypress/fixtures/service-gwa.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: a-service-for-newplatform
host: httpbin.org
host: httpbun.com
tags: [ns.newplatform]
port: 443
protocol: https
Expand All @@ -19,7 +19,7 @@ services:
path_handling: v0

- name: a-service-for-newplatform-test
host: httpbin.org
host: httpbun.com
tags: [ns.newplatform]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/service-permission-gwa.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: service-for-permission
host: httpbin.org
host: httpbun.com
tags: [ns.permission]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/service-permission.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: service-for-permission
host: httpbin.org
host: httpbun.com
tags: [ns.permission]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/service-plugin_A.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: a-service-for-newplatform
host: httpbin.org
host: httpbun.com
tags: [ns.newplatform.test]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/service-plugin_B.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: a-service-for-newplatform-test
host: httpbin.org
host: httpbun.com
tags: [ns.newplatform.test]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/service-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: a-service-for-newplatform-test
host: httpbin.org
host: httpbun.com
tags: [ns.newplatform]
port: 446
protocol: https
Expand Down
4 changes: 2 additions & 2 deletions e2e/cypress/fixtures/service.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
- name: a-service-for-newplatform
host: httpbin.org
host: httpbun.com
tags: [ns.newplatform]
port: 443
protocol: https
Expand All @@ -19,7 +19,7 @@ services:
path_handling: v0

- name: a-service-for-newplatform-test
host: httpbin.org
host: httpbun.com
tags: [ns.newplatform]
port: 443
protocol: https
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/tthidden-jwt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ displayName: two-tier-hidden Display Name
kind: GatewayService
name: two-tier-service-dev
tags: [ns.two-tier-hidden]
host: httpbin.org
host: httpbun.com
port: 443
protocol: https
retries: 0
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/tthidden-key-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ displayName: two-tier-hidden Display Name
kind: GatewayService
name: two-tier-service-dev
tags: [ns.two-tier-hidden]
host: httpbin.org
host: httpbun.com
port: 443
protocol: https
retries: 0
Expand Down
5 changes: 4 additions & 1 deletion e2e/cypress/tests/01-api-key/01-create-api.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ it('Verify gwa gateway publish multiple config file', () => {
})
})

it('verify status of the services using "gwa status" command', () => {
// TODO: Remove this once we have a way to test the status command with the kube API in e2e tests
const runIfKubeAPI = Cypress.env('HAS_KUBE_API') ? it : it.skip;

runIfKubeAPI('verify status of the services using "gwa status" command', () => {
cy.get('@apiowner').then(({ product }: any) => {
cy.executeCliCommand('gwa status').then((response) => {
expect(response.stdout).to.contain(product.environment.config.serviceName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Verify Gateway Service details', () => {
})

it('Verify the host details ', () => {
gs.verifyHostName('httpbin.org')
gs.verifyHostName('httpbun.com')
})

it('Verify the Tags details ', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('Regenerate Credential for Client Credentials- Client ID/Secret', () =>
})
})

it('Regenrate credential client ID and Secret', () => {
it('Regenerate credential client ID and Secret', () => {
cy.visit(myAccessPage.path)
cy.get('@developer').then(({ clientCredentials }: any) => {
myAccessPage.regenerateCredential(clientCredentials.clientIdSecret.product.environment, clientCredentials.clientIdSecret.application.name)
Expand Down
Loading
Loading