Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R1.2.6 bug fixes and ns access ui upgrade #759

Merged
merged 8 commits into from
Feb 22, 2023
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
12 changes: 1 addition & 11 deletions .github/workflows/aps-cypress-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Deploy Cypress and Execute Tests

on:
push:
branches: ['test']
branches: ['test', 'cypress/*']

env:
DASHBOARD_PROJECT_ID: ${{ secrets.CY_DASHBOARD_PRJ_ID }}
Expand Down Expand Up @@ -59,16 +59,6 @@ jobs:
name: test-results
path: ${{ github.workspace }}/e2e/results/report

- name: Upload E2E Code Coverage Report
uses: actions/upload-artifact@v2
with:
name: code-coverage
path: ${{ github.workspace }}/e2e/coverage

- name: Format LCOV Report
run: |
sudo sed -i -r 's/\.*\/app\/nextapp\///g' ./e2e/coverage/lcov.info

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/ci-build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ jobs:
maxUnavailable: 100%

readinessProbe:
timeoutSeconds: 20
timeoutSeconds: 30
periodSeconds: 120

livenessProbe:
timeoutSeconds: 20
timeoutSeconds: 30
periodSeconds: 120

persistence:
enabled: true
Expand Down Expand Up @@ -162,8 +164,8 @@ jobs:
replicaCount: 1

rollingUpdate:
maxUnavailable: 50%
maxSurge: 50%
maxUnavailable: 100%
maxSurge: 0%

image:
repository: ${{ env.REGISTRY }}/bcgov/api-services-portal/api-services-portal
Expand Down Expand Up @@ -281,8 +283,10 @@ jobs:
value: 'FB000000'
GWA_RES_SVR_CLIENT_ID:
value: '${{ secrets.OIDC_CLIENT_ID }}'
secure: true
GWA_RES_SVR_CLIENT_SECRET:
value: '${{ secrets.OIDC_CLIENT_SECRET }}'
secure: true
KEYCLOAK_AUTH_URL:
value: '${{ secrets.KEYCLOAK_AUTH }}'
KEYCLOAK_REALM:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
entity: CredentialIssuer
record:
id: 'Shared IdP'
namespace: platform
description: 'Shared IdP Authorization Profile'
flow: client-credentials
mode: auto
clientAuthenticator: client-secret
authPlugin: jwt-keycloak
clientRoles: []
owner: api-owner@local
isShared: true
environmentDetails:
- environment: prod
issuerUrl: '{OIDC_ISSUER}'
clientId: '{OIDC_CLIENT_ID}'
clientSecret: '{OIDC_CLIENT_SECRET}'
clientRegistration: managed
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ record:
- GatewayConfig.Publish
- Content.Publish
- CredentialIssuer.Admin
owner: user_api-owner
owner: api-owner@local
environmentDetails:
- environment: prod
issuerUrl: '{OIDC_ISSUER}'
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

python scripts/template.py scripts/feeder-init/legal.yaml legal.yaml
python scripts/template.py scripts/feeder-init/platform-authz-profile.yaml platform-authz-profile.yaml
python scripts/template.py scripts/feeder-init/platform-authz-profile-shared.yaml platform-authz-profile-shared.yaml
python scripts/template.py scripts/feeder-init/platform-dataset.yaml platform-dataset.yaml
python scripts/template.py scripts/feeder-init/platform-gwa-api.yaml platform-gwa-api.yaml

sleep 15

while true; do
status=$(curl -o /dev/null -Isw '%{http_code}\n' ${PORTAL_URL}/health)
echo "$status"
Expand All @@ -16,6 +19,7 @@ while true; do
sleep 5
curl --fail -v http://localhost:8080/push -F yaml=@legal.yaml
curl --fail -v http://localhost:8080/push -F yaml=@platform-authz-profile.yaml
curl --fail -v http://localhost:8080/push -F yaml=@platform-authz-profile-shared.yaml
curl --fail -v http://localhost:8080/push -F yaml=@platform-dataset.yaml
curl --fail -v http://localhost:8080/push -F yaml=@platform-gwa-api.yaml
curl --fail -v http://localhost:8080/push -F yaml=@scripts/feeder-init/organization-unit.yaml
Expand Down
8 changes: 4 additions & 4 deletions e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM cypress/included:9.2.0
FROM cypress/included:12.4.0

WORKDIR /e2e

RUN apt-get install curl
RUN apt-get -y update; apt-get -y install curl

COPY cypress.json /e2e
COPY cypress.config.ts /e2e
COPY tsconfig.json /e2e
COPY package.json /e2e
COPY package-lock.json /e2e
COPY entrypoint.sh /tmp
ADD cypress /e2e/cypress

RUN npm install --production
RUN npm install

ENTRYPOINT ["npm", "run", "cy:run:html"]
63 changes: 63 additions & 0 deletions e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import cypress, { defineConfig } from 'cypress'

export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
// require('@cypress/code-coverage/task')(on, config)
// // include any other plugin code...

// // It's IMPORTANT to return the config object
// // with any changed environment variables
config.specPattern=['./cypress/tests/01-*/*.ts',
'./cypress/tests/02-*/*.ts',
'./cypress/tests/03-*/*.ts',
'./cypress/tests/04-*/*.ts',
'./cypress/tests/05-*/*.ts',
'./cypress/tests/06-*/*.ts',
'./cypress/tests/07-*/*.ts',
'./cypress/tests/08-*/*.ts',
'./cypress/tests/09-*/*.ts',
'./cypress/tests/10-*/*.ts',
'./cypress/tests/11-*/*.ts',
'./cypress/tests/12-*/*.ts',
'./cypress/tests/13-*/*.ts',
'./cypress/tests/14-*/*.ts'
]
return config
},
baseUrl: 'http://oauth2proxy.localtest.me:4180',
specPattern: 'cypress/tests/**/*.cy.ts',
screenshotOnRunFailure: true,
screenshotsFolder: 'results/report/assets',
video: false,
testIsolation: false,
watchForFileChanges: false,
reporter: 'mochawesome',
reporterOptions: {
reportDir: 'results',
html: false,
json: true,
overwrite: false,
},
chromeWebSecurity: false,
env: {
CLIENT_ID: 'aps-portal',
CLIENT_SECRET: '8e1a17ed-cb93-4806-ac32-e303d1c86018',
OIDC_ISSUER: 'http://keycloak.localtest.me:9080',
TOKEN_URL:
'http://keycloak.localtest.me:9080/auth/realms/master/protocol/openid-connect/token',
GWA_API_URL: 'http://gwa-api.localtest.me:2000/v2',
KONG_URL: 'http://kong.localtest.me:8000',
JWKS_URL: 'http://cypress-jwks-url.localtest.me:3500',
KONG_CONFIG_URL: 'http://kong.localtest.me:8001',
BASE_URL: 'http://oauth2proxy.localtest.me:4180',
KEYCLOAK_URL: 'http://keycloak.localtest.me:9080',
},
retries: {
runMode: 2,
openMode: 0,
}
},
})
32 changes: 0 additions & 32 deletions e2e/cypress.json

This file was deleted.

6 changes: 3 additions & 3 deletions e2e/cypress/fixtures/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@
"mode": "auto",
"environmentDetails": [
{
"environment": "prod",
"issuerUrl": "http://keycloak.test.localtest.me:9080/auth/realms/master",
"environment": "test",
"issuerUrl": "http://keycloak.localtest.me:9080/auth/realms/master",
"clientRegistration": "managed",
"clientId": "gwa-api",
"clientSecret": "18900468-3db1-43f7-a8af-e75f079eb742"
Expand All @@ -182,7 +182,7 @@
"mode": "auto",
"environmentDetails": [
{
"environment": "prod",
"environment": "test",
"issuerUrl": "http://keycloak.localtest.me:9080/auth/realms/master",
"clientRegistration": "managed",
"clientId": "gwa-api",
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/apiowner.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"terms": "Terms of Use for API Gateway",
"authorization": "Kong API Key with ACL Flow",
"optionalInstructions": "This is a automation test",
"serviceName": "a-service-for-deleteplatform"
"serviceName": "service-for-deleteplatform"
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions e2e/cypress/fixtures/developer.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
"description": "Application for testing client credential flow."
}
},
"clientIdSecret_sharedIDP": {
"product": {
"name": "Auto Test Product",
"environment": "test"
},
"application": {
"name": "Client ID and Secret App for Shared IDP",
"description": "Application for testing client credential flow."
}
},
"clientIdSecret_invalid": {
"product": {
"name": "Client Credentials Test Product",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"username": "consumer1"
},
"keyAuth": {
"config.anonymous": "9a9e8bb2-02b1-4fe0-8b8a-591261cf1611"
"config.anonymous": "09f98d53-4797-4ba9-a9e8-6417a1cee3b0"
}
}
7 changes: 4 additions & 3 deletions e2e/cypress/fixtures/state/regen.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"apikey": "NjR2PniJ6ToOVP9O7nJ5QfQiqDUhUEjq",
"consumernumber": "3CBD4EB1-9E07D3FBF2F",
"clientidsecret": "{\"clientId\": \"B297ECBB-F562BDAE027\", \"clientSecret\": \"8473aa8e-5cfd-403c-b4f6-c4ee88fc038d\", \"tokenEndpoint\": \"http://keycloak.localtest.me:9080/auth/realms/master/protocol/openid-connect/token\"}"
"apikey": "qiHHqk9lIzTgP1j94nHp5C1bNVJBOWnG",
"consumernumber": "B15172D9-F103D11A9A1",
"clientidsecret": "{\"clientId\": \"A7D72430-52CD37B2420\", \"clientSecret\": \"282718d8-d0c2-45a0-8885-3539f0ca5fea\", \"tokenEndpoint\": \"http://keycloak.localtest.me:9080/auth/realms/master/protocol/openid-connect/token\"}",
"credentials": "{\"clientId\": \"sa-ccplatform-e0000000-d339cbfcda5e\", \"clientSecret\": \"f5127730-df13-453d-ace0-a30a1255e30d\"}"
}
4 changes: 1 addition & 3 deletions e2e/cypress/fixtures/state/store.json
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{
"newapikey": "GJhaEADSMCtdUOjgErkSgtTw15KoASLu"
}
{}
6 changes: 3 additions & 3 deletions e2e/cypress/fixtures/test_data/authorizationProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"clientAuthenticator": "client-secret",
"name": "my-auth-client-secret",
"description": "Auth connection to my IdP",
"owner": "janis@idir"
"owner": "janis@testmail.com"
}
},
{
Expand All @@ -40,7 +40,7 @@
"clientSecret": "43badfc1-c06f-4bec-bab6-ccdc764071ac"
}
],
"owner": "janis@idir"
"owner": "janis@testmail.com"
}
},
{
Expand All @@ -59,7 +59,7 @@
"clientSecret": "43badfc1-c06f-4bec-bab6-ccdc764071ac"
}
],
"owner": "janis@idir"
"owner": "janis@testmail.com"
}
}
]
1 change: 0 additions & 1 deletion e2e/cypress/pageObjects/apiDirectory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { checkElementExists } from '../support'

class ApiDirectoryPage {
path: string = '/devportal/api-directory'
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/pageObjects/consumers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Assertion } from "chai"
import { wrap } from "module"
import dateformat from 'dateformat'
import { checkElementExists } from "../support"
import { checkElementExists } from "../support/e2e"

export default class ConsumersPage {
path: string = '/manager/consumers'
Expand Down
4 changes: 2 additions & 2 deletions e2e/cypress/pageObjects/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HomePage {
cy.get(this.namespaceNameInput).type(name) // using `platform` as a default ns as its being seeding through feeder
cy.get(this.nsCreateBtn).click()
cy.verifyToastMessage("Namespace "+name+" created!")
cy.wait(2000) // wait for dropdown to have latest text
cy.wait(5000) // wait for dropdown to have latest text
cy.get(this.nsDropdown).then(($el) => {
expect($el).contain(name)
})
Expand All @@ -26,7 +26,7 @@ class HomePage {
var flag = new Boolean(false);
cy.get(this.nsDropdown).click()
cy.get(this.getNamespaceTestId(name)).click()
cy.wait(2000) // wait for dropdown to have latest text
cy.wait(5000) // wait for dropdown to have latest text
cy.get(this.nsDropdown).then(($el) => {
expect($el.text().trim()).to.eq(name)
flag = true
Expand Down
Loading