-
Canarytrace can run your WDIO test script for testing and measuring user journey.CronJob examples with
Cloning from public or private Git repositoryCanarytrace for cloning from a public Git repository and for run WDIO test script use these environment variables
For cloning from a private Git repository, you must generate ssh key without password and deploy private part into your Kubernetes cluster via "secret" and public part you must save into "deploy keys" of your Git repository provider. Do not forget add secret definition in your CronJob If you want cloning test cases from private Git repository, e.g. ...
- name: canarytrace-secret
secret:
secretName: canarytrace-secret |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Full exampleGenerating ssh key # command
ssh-keygen -t ed25519 -C "name@company.com"
# do not use username and password
Generating public/private ed25519 key pair.
Enter file in which to save the key (/Users/rdpanek/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/rdpanek/.ssh/id_ed25519
Your public key has been saved in /Users/rdpanek/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:YTxp0/sq/EREUqp1vV5fIZCFcQhbiX0gDU8SW7Haj5s name@company.com
The key's randomart image is:
+--[ED25519 256]--+
| .BXOXo |
| . BXO+. |
| @o+oo. . |
| = *o. .. .|
| . S.o.. . .|
| . oo. ..|
| . ..o. .|
| o. .o |
| ooE |
+----[SHA256]-----+ Create and deploy secret
# command
kubectl -n canarytrace create secret generic secret-github --from-file=ssh-privatekey=/Users/rdpanek/.ssh/id_ed25519
# result
secret/secret-github created Upload a public part of your ssh key into Git environment Prepare your CronJob
apiVersion: batch/v1
kind: CronJob
metadata:
name: canary-user-journey
namespace: canarytrace
spec:
concurrencyPolicy: Replace
failedJobsHistoryLimit: 2
schedule: "*/4 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: canary
image: quay.io/canarytrace/canarytrace:XYZ
env:
- name: BASE_URL
value: "https://the-internet.herokuapp.com/login"
- name: GIT_REVISION
value: "d63ebda"
- name: SPEC
value: "test/specs/example.e2e.js"
- name: LABELS
value: "wdio75, demo, smoke"
- name: MODE
value: "user-journey"
- name: GIT_REPOSITORY
value: "git@github.com:canarytrace/XYZ.git"
- name: GIT_REPOSITORY_HOST
value: "github.com"
- name: GIT_REPOSITORY_PORT
value: "22"
- name: ELASTIC_CLUSTER
value: "http://XYZ:9200"
- name: LICENSE
value: "XYZ-XYZ-XYZ-XYZ-XYZ-XYZ"
resources:
requests:
memory: "300Mi"
cpu: "200m"
limits:
memory: "1600Mi"
cpu: "800m"
imagePullPolicy: "IfNotPresent"
volumeMounts:
- mountPath: /secret
name: secret-github
readOnly: true
- name: chrome
image: selenium/standalone-chrome:4.7.2-20221219
ports:
- containerPort: 4444
resources:
requests:
memory: "2000Mi"
cpu: "2000m"
limits:
memory: "4000Mi"
cpu: "4000m"
imagePullPolicy: "IfNotPresent"
volumeMounts:
- mountPath: "/dev/shm"
name: "dshm"
livenessProbe:
httpGet:
path: /status
port: 4444
initialDelaySeconds: 10
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /status
port: 4444
initialDelaySeconds: 10
timeoutSeconds: 5
restartPolicy: "Never"
terminationGracePeriodSeconds: 5
volumes:
- name: secret-github
secret:
secretName: secret-github
- name: "dshm"
emptyDir:
medium: "Memory"
- name: canarytrace-secret
secret:
secretName: canarytrace-secret Deploy to Kubernetes # command
kubectl create -f user-journey.yaml
# result
cronjob.batch/canary-user-journey created Log ______ __
/ ____/___ _____ ____ ________ __/ /__________ _________
/ / / __ `/ __ \/ __ `/ ___/ / / / __/ ___/ __ `/ ___/ _ \
/ /___/ /_/ / / / / /_/ / / / /_/ / /_/ / / /_/ / /__/ __/
\____/\__,_/_/ /_/\__,_/_/ \__, /\__/_/ \__,_/\___/\___/
/____/
Canarytrace: <version> https://canarytrace.com
WebdriverIO: 7.23.0
Lighthouse: 9.6.8
Node.js: v18.7.0
Canarytrace uuid: 08012313423301371500000000000000
Canarytrace mode: user-journey
------------------------------
Use ssh key
lrwxrwxrwx 1 root root 21 Jan 8 13:42 /secret/ssh-privatekey -> ..data/ssh-privatekey
Agent pid 30
Identity added: (stdin) (name@company.com)
-rw-r--r-- 1 root root 1264 Jan 4 14:33 /etc/passwd
node
# github.com:22 SSH-2.0-babeld-4ce3b487
# github.com:22 SSH-2.0-babeld-4ce3b487
# github.com:22 SSH-2.0-babeld-4ce3b487
# github.com:22 SSH-2.0-babeld-4ce3b487
# github.com:22 SSH-2.0-babeld-456f9bbd
github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
Cloning a git repository git@github.com:canarytrace/wdio75-demo.git into /opt/canary/tests
------------------------
Cloning into '/opt/canary/tests'...
Note: switching to 'd63ebda'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at d63ebda demo test
Execution of 1 workers started at 2023-01-08T13:42:45.535Z
[0-0] Canarytrace:labels:mode=canarytrace-pro-<version>,engine=wdio,wdio75, demo, smoke
[0-0] Canarytrace:uuid:08012313423301371500000000000000
[0-0] RUNNING in chrome - /tests/test/specs/example.e2e.js
[0-0] Canarytrace:Start:My Login application should login with valid credentials
[0-0] Canarytrace:PerformanceEntries:My Login application should login with valid credentials:13
[0-0] PASSED in chrome - /tests/test/specs/example.e2e.js
"spec" Reporter:
------------------------------------------------------------------
[chrome 108.0.5359.124 LINUX #0-0] Running: chrome (v108.0.5359.124) on LINUX
[chrome 108.0.5359.124 LINUX #0-0] Session ID: bc801275906e8e5f44c5ed69e0f07d8e
[chrome 108.0.5359.124 LINUX #0-0]
[chrome 108.0.5359.124 LINUX #0-0] » /tests/test/specs/example.e2e.js
[chrome 108.0.5359.124 LINUX #0-0] My Login application
[chrome 108.0.5359.124 LINUX #0-0] ✓ should login with valid credentials
[chrome 108.0.5359.124 LINUX #0-0]
[chrome 108.0.5359.124 LINUX #0-0] 1 passing (2.7s)
Spec Files: 1 passed, 1 total (100% completed) in 00:00:10
npm notice
npm notice New major version of npm available! 8.15.0 -> 9.2.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.2.0>
npm notice Run `npm install -g npm@9.2.0` to update!
npm notice
Canarytrace uuid: 08012313423301371500000000000000, labels: wdio75, demo, smoke
Saved assets
------------
total 16K
drwxr-xr-x 1 node node 4.0K Jan 8 13:42 .
drwxr-xr-x 1 node node 4.0K Jan 8 13:42 ..
-rw-r--r-- 1 node node 2 Jan 8 13:42 reportedTestEnd.log |
Beta Was this translation helpful? Give feedback.
Full example
Generating ssh key