Skip to content
Open
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
42 changes: 29 additions & 13 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,28 @@ jobs:
NODE_OPTIONS: --max_old_space_size=16384
run: xvfb-run npm run test:coverage --silent

# Non-cluster UI tests don't need Kind - run them before it starts so they
# don't have to share the runner with an already-running local cluster.
- name: Prepare UI Tests
env:
NODE_OPTIONS: --max_old_space_size=16384
if: runner.os == 'Linux'
run: |
# Patch vscode:prepublish to reinstall secretlint AFTER prune
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.scripts['vscode:prepublish'] += ' && npm install --ignore-scripts @secretlint/node';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
npm run ui-test:prepare

- name: Run Non-Cluster UI Tests
env:
NODE_OPTIONS: --max_old_space_size=16384
if: runner.os == 'Linux'
run: xvfb-run --server-args="-screen 0 1920x1080x24" npm run public-ui-test

- name: Start KinD cluster
if: (success() || failure()) && runner.os == 'Linux'
uses: helm/kind-action@v1.14.0
Expand All @@ -102,21 +124,15 @@ jobs:
nb=`kubectl get pods -n operators --no-headers --ignore-not-found | grep Running | wc -l`
done
echo CLUSTER_URL=`kubectl cluster-info | sed -n -e "s/\x1B\[[0-9;]*[a-zA-Z]//g" -e '1s/.*running at \(.*\)$/\1/p'` >> $GITHUB_ENV
# UI tests fail under linux
# Run UI tests
- name: Run UI Tests

# Runs regardless of whether the non-cluster UI tests passed - each npm script
# launches its own fresh VS Code/browser session, so a crash or failure in the
# non-cluster suite doesn't take the cluster suite's results down with it.
- name: Run Cluster UI Tests
env:
NODE_OPTIONS: --max_old_space_size=16384
if: runner.os == 'Linux'
run: |
# Patch vscode:prepublish to reinstall secretlint AFTER prune
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.scripts['vscode:prepublish'] += ' && npm install --ignore-scripts @secretlint/node';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
xvfb-run --server-args="-screen 0 1920x1080x24" npm run public-ui-test
if: (success() || failure()) && runner.os == 'Linux'
run: xvfb-run --server-args="-screen 0 1920x1080x24" npm run public-ui-kind-test

- name: Build and run integration tests
if: (success() || failure()) && runner.os == 'Linux'
Expand Down
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,31 @@
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"name": "Debug UI Kind Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/extest",
"args": [
"run-tests",
"${workspaceFolder}/out/test/ui/public-ui-kind-test.js",
"-o",
"${workspaceFolder}/test/ui/settings.json",
"-m",
"${workspaceFolder}/test/ui/.mocharc.js",
"-e",
"${workspaceFolder}/test-resources/extensions",
"-c",
"max"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"sourceMaps": true,
"preLaunchTask": "setup-tests",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "chrome",
"request": "launch",
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ then run:
npm run public-ui-test
```

There's also `npm run public-ui-kind-test`, which covers the subset of public-facing
UI tests that need a cluster but don't need real OpenShift-specific features (e.g.
operator-backed services, component commands). CI runs this against a local `kind`
cluster; it's separate from `cluster-ui-test` below, which needs a real OpenShift login.

In order to run the cluster-dependant UI tests,
you need an OpenShift cluster where you can create and delete projects.
This means that OpenShift Developer Sandbox won't work.
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@
"test-integration": "npm run test:prepare && node ./build/run-tests.cjs integration",
"test-integration:coverage": "npm run test:prepare && npm run test:instrument && node ./build/run-tests.cjs integration",
"cluster-ui-test": ". test/ui/extester.env && extest setup-tests -e ./test-resources/extensions -i && npm run test:prepare && extest run-tests out/test/ui/cluster-ui-test.js -o test/ui/settings.json -m test/ui/.mocharc.js -e ./test-resources/extensions",
"public-ui-test": ". test/ui/extester.env && extest setup-tests -e ./test-resources/extensions -i && npm run test:prepare && extest run-tests out/test/ui/public-ui-test.js -o test/ui/settings.json -m test/ui/.mocharc.js -e ./test-resources/extensions"
"ui-test:prepare": ". test/ui/extester.env && extest setup-tests -e ./test-resources/extensions -i && npm run test:prepare",
"public-ui-test": "extest run-tests out/test/ui/public-ui-test.js -o test/ui/settings.json -m test/ui/.mocharc.js -e ./test-resources/extensions",
"public-ui-kind-test": "extest run-tests out/test/ui/public-ui-kind-test.js -o test/ui/settings.json -m test/ui/.mocharc.js -e ./test-resources/extensions"
},
"dependencies": {
"jsonc-parser": "^3.3.1",
Expand Down
104 changes: 104 additions & 0 deletions test/fixtures/components/nodejs-starter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
23 changes: 23 additions & 0 deletions test/fixtures/components/nodejs-starter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Install the app dependencies in a full Node docker image
FROM registry.access.redhat.com/ubi8/nodejs-18:latest

# Copy package.json, and optionally package-lock.json if it exists
COPY package.json package-lock.json* ./

# Install app dependencies
RUN \
if [ -f package-lock.json ]; then npm ci; \
else npm install; \
fi

# Copy the dependencies into a Slim Node docker image
FROM registry.access.redhat.com/ubi8/nodejs-18-minimal:latest

# Install app dependencies
COPY --from=0 /opt/app-root/src/node_modules /opt/app-root/src/node_modules
COPY . /opt/app-root/src

ENV NODE_ENV production
ENV PORT 3001

CMD ["npm", "start"]
Loading
Loading