Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksiAhtiainen committed Oct 21, 2024
1 parent 89e6ca5 commit a967eaf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 11 deletions.
12 changes: 6 additions & 6 deletions omadata-oauth2-sample/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"start-server": "npm run --prefix ../server start",
"start-with-server": "npm-run-all --parallel start-server start",
"start-with-server-and-luovutuspalvelu": "npm-run-all --parallel start-luovutuspalvelu start-server start",
"build-luovutuspalvelu": "cd ../../koski-luovutuspalvelu/proxy && mkdir -p ./target && npm run buildversion && npm run testca && node ./scripts/create-local-config.js > ./target/koski-luovutuspalvelu-proxy-config-ci.json && docker build --rm --pull --platform=linux/amd64 --tag koski-luovutuspalvelu-proxy-foo:latest . && sleep 5",
"start-luovutuspalvelu": "echo 'Starting koski-luovutuspalvelu-proxy-foo' && docker ps -a && docker run --name koski-luovutuspalvelu-proxy-foo -p 7022:443 -v \"$PWD/../../koski-luovutuspalvelu/proxy/target/koski-luovutuspalvelu-proxy-config-ci.json:/etc/nginx/koski-luovutuspalvelu-proxy-config.json:ro\" -m 256m --rm koski-luovutuspalvelu-proxy-foo:latest",
"clean-luovutuspalvelu-container": "docker ps -a && echo 'Killing koski-luovutuspalvelu-proxy-foo' && docker stop koski-luovutuspalvelu-proxy-foo || true && docker rm koski-luovutuspalvelu-proxy-foo || true && echo 'Killed koski-luovutuspalvelu-proxy-foo' && docker ps -a",
"build-luovutuspalvelu": "cd ../../koski-luovutuspalvelu/proxy && mkdir -p ./target && npm run buildversion && npm run testca && node ./scripts/create-local-config.js > ./target/koski-luovutuspalvelu-proxy-config-ci.json && docker build --rm --pull --platform=linux/amd64 --tag koski-luovutuspalvelu-proxy:latest . && sleep 5",
"start-luovutuspalvelu": "echo 'Starting koski-luovutuspalvelu-proxy' && docker ps -a && docker run --name koski-luovutuspalvelu-proxy -p 7022:443 -v \"$PWD/../../koski-luovutuspalvelu/proxy/target/koski-luovutuspalvelu-proxy-config-ci.json:/etc/nginx/koski-luovutuspalvelu-proxy-config.json:ro\" -m 256m --rm koski-luovutuspalvelu-proxy:latest",
"clean-luovutuspalvelu-container": "docker ps -a && echo 'Killing koski-luovutuspalvelu-proxy' && docker stop koski-luovutuspalvelu-proxy || true && docker rm koski-luovutuspalvelu-proxy || true && echo 'Killed koski-luovutuspalvelu-proxy' && docker ps -a",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
Expand All @@ -45,9 +45,9 @@
"lint:problems": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
"fix": "npm run fix:format",
"fix:format": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\" --fix",
"playwright:test": "npx playwright test",
"playwright:test:debug": "npx playwright test --headed",
"playwright:test:trace": "npx playwright test --trace on && npx playwright show-report",
"playwright:test": "DEBUG=pw:webserver npx playwright test",
"playwright:test:debug": "DEBUG=pw:webserver npx playwright test --headed",
"playwright:test:trace": "DEBUG=pw:webserver npx playwright test --trace on && npx playwright show-report",
"playwright:codegen": "npx playwright codegen"
},
"eslintConfig": {
Expand Down
32 changes: 27 additions & 5 deletions omadata-oauth2-sample/client/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,31 @@ export default defineConfig({
],

/* Run your local dev server before starting the tests */
webServer: {
command: `npm run build-luovutuspalvelu && npm run start-with-server-and-luovutuspalvelu`,
url: "http://localhost:7050",
reuseExistingServer: !process.env.CI,
},
webServer: [
{
command: `npm run build-luovutuspalvelu && npm run start-luovutuspalvelu`,
url: "https://localhost:7022/koski-luovutuspalvelu/healthcheck/proxy",
reuseExistingServer: !process.env.CI,
stdout: "pipe",
stderr: "pipe",
timeout: 10 * 60 * 1000,
ignoreHTTPSErrors: true,
},
{
command: `npm run start-server`,
url: "http://localhost:7051/healthcheck",
reuseExistingServer: !process.env.CI,
stdout: "pipe",
stderr: "pipe",
timeout: 10 * 60 * 1000,
},
{
command: `npm run start`,
url: "http://localhost:7050",
reuseExistingServer: !process.env.CI,
stdout: "pipe",
stderr: "pipe",
timeout: 10 * 60 * 1000,
},
],
})
7 changes: 7 additions & 0 deletions omadata-oauth2-sample/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ async function getSecret(secretName: string): Promise<string> {

app.use(express.static(staticFilesPath))

app.get(
'/healthcheck',
async (req: Request, res: Response, next: NextFunction) => {
res.status(200).send('Ok')
}
)

app.get('/api', async (req: Request, res: Response, next: NextFunction) => {
try {
const accessTokenData = await fetchAccessToken(authorizationServerUrl)
Expand Down

0 comments on commit a967eaf

Please sign in to comment.