Skip to content

Commit

Permalink
wip2
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed AbouZaid <[email protected]>
  • Loading branch information
aabouzaid committed Jun 24, 2024
1 parent 646c72c commit 857349e
Show file tree
Hide file tree
Showing 21 changed files with 1,739 additions and 54 deletions.
58 changes: 28 additions & 30 deletions .github/workflows/test-regression.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,38 @@ jobs:
with:
charts-path: "charts/camunda-platform-8*"

# validation:
# if: ${{ needs.init.outputs.matrix != '[]' }}
# name: Validation - Camunda ${{ matrix.version }}
# needs: init
# strategy:
# fail-fast: false
# matrix:
# version: ${{ fromJson(needs.init.outputs.matrix) }}
# uses: ./.github/workflows/chart-validate-template.yaml
# with:
# identifier: "${{ github.event.pull_request.number }}-vald-${{ matrix.version }}"
# camunda-helm-dir: "camunda-platform-${{ matrix.version }}"
# camunda-helm-git-ref: "${{ github.event.pull_request.head.sha }}"
validation:
if: ${{ needs.init.outputs.matrix != '[]' }}
name: Validation - Camunda ${{ matrix.version }}
needs: init
strategy:
fail-fast: false
matrix:
version: ${{ fromJson(needs.init.outputs.matrix) }}
uses: ./.github/workflows/chart-validate-template.yaml
with:
identifier: "${{ github.event.pull_request.number }}-vald-${{ matrix.version }}"
camunda-helm-dir: "camunda-platform-${{ matrix.version }}"
camunda-helm-git-ref: "${{ github.event.pull_request.head.sha }}"

# unit:
# if: ${{ needs.init.outputs.matrix != '[]' }}
# name: Unit Test - Camunda ${{ matrix.version }}
# needs: [init]
# strategy:
# fail-fast: false
# matrix:
# version: ${{ fromJson(needs.init.outputs.matrix) }}
# uses: ./.github/workflows/test-unit-template.yml
# with:
# identifier: "${{ github.event.pull_request.number }}-unit-${{ matrix.version }}"
# camunda-helm-dir: "camunda-platform-${{ matrix.version }}"
# camunda-helm-git-ref: "${{ github.event.pull_request.head.sha }}"
unit:
if: ${{ needs.init.outputs.matrix != '[]' }}
name: Unit Test - Camunda ${{ matrix.version }}
needs: [init]
strategy:
fail-fast: false
matrix:
version: ${{ fromJson(needs.init.outputs.matrix) }}
uses: ./.github/workflows/test-unit-template.yml
with:
identifier: "${{ github.event.pull_request.number }}-unit-${{ matrix.version }}"
camunda-helm-dir: "camunda-platform-${{ matrix.version }}"
camunda-helm-git-ref: "${{ github.event.pull_request.head.sha }}"

integration:
if: ${{ needs.init.outputs.matrix != '[]' }}
name: Integration Test - Camunda ${{ matrix.version }}
#needs: [init, validation, unit]
needs: [init]
needs: [init, validation, unit]
strategy:
fail-fast: false
matrix:
Expand All @@ -82,7 +81,6 @@ jobs:
identifier: "${{ github.event.pull_request.number }}-intg-${{ matrix.version }}"
deployment-ttl: "${{ contains(github.event.pull_request.labels.*.name, 'test-persistent') && '1w' || '' }}"
platforms: "gke"
flows: "install"
# flows: "install,upgrade"
flows: "install,upgrade"
camunda-helm-dir: "camunda-platform-${{ matrix.version }}"
camunda-helm-git-ref: "${{ github.event.pull_request.head.sha }}"
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ testcases:

# TODO: Use Venom "web" module to test actual login. It's easy but requires "PhantomJS"
# which is not available on Alpine, so it needs to be installed first.
- name: TEST - Interacting with Camunda Platform login page
- name: TEST - Interacting with Camunda login page
steps:
- name: "{{ .value.component }}"
skip:
Expand Down Expand Up @@ -97,7 +97,7 @@ testcases:
- result.body ShouldNotContainSubstring error

# TODO: Add Optimize.
- name: TEST - Interacting with Camunda Platform web API
- name: TEST - Interacting with Camunda web API
steps:
- name: "{{ .value.component }}"
type: http
Expand Down Expand Up @@ -251,4 +251,4 @@ testcases:
# = Request Body: {{ .result.request.body }}
# = Response Body: {{ .result.body }}
assertions:
- result.statuscode ShouldEqual 200
- result.statuscode ShouldEqual 200
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ testcases:
url: "{{ .preflightVars.baseURLs.tasklist }}/actuator/health/liveness"
- component: Connectors
url: "{{ .preflightVars.baseURLs.connectors }}/actuator/health/liveness"
- component: Zeebe-Gateway
url: "{{ .preflightVars.baseURLs.zeebeGateway }}/actuator/health/liveness"
- component: ZeebeGateway
url: "{{ .preflightVars.baseURLs.zeebeGateway }}/health"
method: GET
url: "{{ .value.url }}"
retry: 3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
# NOTE: WebModeler has its own step because Venom doesn't support skip in loops yet.
# https://github.com/ovh/venom/issues/651
name: Test core functionality of Camunda

# Vars without defaults are passed as a Venom var, e.g. "VENOM_VAR_TEST_CLIENT_SECRET".
vars:
releaseName: integration
venomClientID: '{{ .TEST_CLIENT_ID | default "venom" }}'
venomClientSecret: '{{ .TEST_CLIENT_SECRET }}'
skipTestIngress: '{{ .SKIP_TEST_INGRESS }}'
skipTestWebModeler: '{{ .SKIP_TEST_WEBMODELER }}'

testcases:

# https://docs.camunda.io/docs/self-managed/identity/user-guide/generating-m2m-tokens/
- name: TEST - Generating machine-to-machine token
steps:
- name: "{{ .value.component }}"
type: http
range:
- component: Tasklist
clientID: tasklist
clientSecret: "{{ .TASKLIST_CLIENT_SECRET }}"
- component: Operate
clientID: operate
clientSecret: "{{ .OPERATE_CLIENT_SECRET }}"
- component: Optimize
clientID: optimize
clientSecret: "{{ .OPTIMIZE_CLIENT_SECRET }}"
- component: Connectors
clientID: connectors
clientSecret: "{{ .CONNECTORS_CLIENT_SECRET }}"
method: POST
url: "{{ .coreVars.authURL }}"
headers:
Content-Type: application/x-www-form-urlencoded
body: |-
client_id={{ .value.clientID }}&client_secret={{ .value.clientSecret }}&grant_type=client_credentials
# info: |
# Component: {{ .value.component }}
# = Response Body: {{ .result.body }}
assertions:
- result.statuscode ShouldEqual 200

# Helper to get access token for Venom Identity client which's seeded during Helm deployment.
- name: helperVenomToken
steps:
- name: Get Venom token
type: http
method: POST
url: "{{ .coreVars.authURL }}"
headers:
Content-Type: application/x-www-form-urlencoded
body: "client_id={{ .venomClientID }}&client_secret={{ .venomClientSecret }}&grant_type=client_credentials"
# info: |
# = Response Body: {{ .result.body }}
assertions:
- result.statuscode ShouldEqual 200
vars:
jwt:
from: result.bodyjson.access_token

# TODO: Use Venom "web" module to test actual login. It's easy but requires "PhantomJS"
# which is not available on Alpine, so it needs to be installed first.
- name: TEST - Interacting with Camunda login page
steps:
- name: "{{ .value.component }}"
skip:
- skiptestingress ShouldBeFalse
type: http
range:
- component: Keycloak
url: "{{ .coreVars.baseURLs.keycloak }}"
- component: Identity
url: "{{ .coreVars.baseURLs.identity }}"
- component: Operate
url: "{{ .coreVars.baseURLs.operate }}"
- component: Optimize
url: "{{ .coreVars.baseURLs.optimize }}"
- component: Tasklist
url: "{{ .coreVars.baseURLs.tasklist }}"
- component: Connectors
url: "{{ .coreVars.baseURLs.connectors }}"
- component: WebModeler
url: "{{ .coreVars.baseURLs.webModeler }}"
method: GET
url: "{{ .value.url }}"
retry: 3
delay: 15
# info: |
# Component: {{ .value.component }}
# = Request Method: {{ .value.method }}
# = Request Body: {{ .result.request.body }}
# = Response Body: {{ .result.body }}
assertions:
- result.statuscode ShouldEqual 200
- result.body ShouldNotContainSubstring error

# TODO: Add Optimize.
- name: TEST - Interacting with Camunda web API
steps:
- name: "{{ .value.component }}"
type: http
range:
- component: Identity
url: "{{ .coreVars.baseURLs.identity }}/api/users"
method: GET
body: ''
- component: Operate
docs: https://docs.camunda.io/docs/self-managed/operate-deployment/operate-authentication/
url: "{{ .coreVars.baseURLs.operate }}/v1/process-definitions/search"
method: POST
body: '{}'
- component: Tasklist
docs: https://docs.camunda.io/docs/self-managed/tasklist-deployment/tasklist-authentication/
url: "{{ .coreVars.baseURLs.tasklist }}/graphql"
method: POST
body: '{"query": "{tasks(query:{}){id name}}"}'
method: "{{ .value.method }}"
url: "{{ .value.url }}"
headers:
Content-Type: application/json
Authorization: "Bearer {{ .helperVenomToken.jwt }}"
body: "{{ .value.body }}"
# info: |
# Component: {{ .value.component }}
# = Request Method: {{ .value.method }}
# = Request Body: {{ .result.request.body }}
# = Response Body: {{ .result.body }}
assertions:
- result.statuscode ShouldEqual 200

# Unlike other apps, WebModeler by default expects the JWT token to be acquired from external Keycloak URL.
# Hence, this test is added in the extra tests when Ingress is enabled.
- name: TEST - Interacting with WebModeler
steps:
# TODO: Check why WM 8.3.0 cannot be accessed internally.
# - name: Check WebModeler internal API
# skip:
# - skiptestwebmodeler ShouldBeFalse
# type: http
# method: GET
# url: "{{ .coreVars.baseURLs.webModelerRestapi }}/api/v1/info"
# headers:
# Content-Type: application/json
# Authorization: "Bearer {{ .helperVenomToken.jwt }}"
# # info: |
# # = Request Body: {{ .result.request.body }}
# # = Response Body: {{ .result.body }}
# assertions:
# - result.statuscode ShouldEqual 200
# - result.bodyjson.version ShouldNotBeEmpty
- name: Check WebModeler login page
skip:
- skiptestingress ShouldBeFalse
- skiptestwebmodeler ShouldBeFalse
type: http
method: GET
url: "{{ .coreVars.baseURLs.webModeler }}"
retry: 3
delay: 15
# info: |
# Component: {{ .value.component }}
# = Request Method: {{ .value.method }}
# = Request Body: {{ .result.request.body }}
# = Response Body: {{ .result.body }}
assertions:
- result.statuscode ShouldEqual 200
- result.body ShouldNotContainSubstring error

- name: TEST - Interacting with Zeebe Gateway
steps:
- name: Check Zeebe Gateway status
type: exec
script: |
zbctl --clientCache=/tmp/zeebe \
--clientId {{ .venomClientID }} --clientSecret {{ .venomClientSecret }} \
--authzUrl "{{ .coreVars.authURL }}" --address "{{ .coreVars.baseURLs.zeebeGateway }}" \
{{ .coreVars.zbctl.extraArgs }} \
status
retry: 2
delay: 10
# info: |
# = systemerr: {{ .result.systemerr }}
# = err: {{ .result.err }}
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldContainSubstring "Leader, Healthy"
- result.systemout ShouldNotContainSubstring Unhealthy
- result.timeseconds ShouldBeLessThan 1

- name: TEST - Deploying BPMN process
steps:
- name: Deploy BPMN process to Zeebe - {{ .value.name }}
type: exec
range:
- name: Basic
file: test-process.bpmn
- name: Inbound Connector
file: test-inbound-process.bpmn
script: |
zbctl --clientCache=/tmp/zeebe \
--clientId {{ .venomClientID }} --clientSecret {{ .venomClientSecret }} \
--authzUrl "{{ .coreVars.authURL }}" --address "{{ .coreVars.baseURLs.zeebeGateway }}" \
{{ .coreVars.zbctl.extraArgs }} \
deploy /mnt/fixtures/{{ .value.file }}
# info: |
# = systemerr: {{ .result.systemerr }}
# = err: {{ .result.err }}
assertions:
- result.code ShouldEqual 0

- name: TEST - Check deployed BPMN process
steps:
- name: Check deployed BPMN process in Operate - {{ .value.name }}
type: http
range:
- name: Basic
id: it-test-process
- name: Inbound Connector
id: test-inbound-process
method: POST
url: "{{ .coreVars.baseURLs.operate }}/v1/process-definitions/search"
headers:
Content-Type: application/json
Authorization: "Bearer {{ .helperVenomToken.jwt }}"
body: '{}'
retry: 3
delay: 15
# info: |
# = Request Body: {{ .result.request.body }}
# = Response Body: {{ .result.body }}
assertions:
- result.statuscode ShouldEqual 200
# NOTE: JSON keys are lowercased automatically, the original key is "bpmnProcessId".
- result.bodyjson.items.items{{ .index }}.bpmnprocessid ShouldEqual {{ .value.id }}

- name: TEST - Check Connectors webhook
steps:
- name: Check deployed BPMN webhook
type: http
method: POST
url: "{{ .coreVars.baseURLs.connectors }}/test-mywebhook"
headers:
Content-Type: application/json
Authorization: "Bearer {{ .helperVenomToken.jwt }}"
body: '{"webhookDataKey":"webhookDataValue"}'
retry: 4
delay: 15
# info: |
# = Request Body: {{ .result.request.body }}
# = Response Body: {{ .result.body }}
assertions:
- result.statuscode ShouldEqual 200

- name: TEST - Check ServiceMonitor
steps:
- name: Check prometheus could query containers
type: http
method: GET
url: "http://{{ .coreVars.baseURLs.prometheus }}/api/v1/query?query=system_cpu_count%7Bnamespace%3D%22{{ .coreVars.testNamespace }}%22%7D"
retry: 4
delay: 15
# info: |
# = Request Body: {{ .result.request.body }}
# = Response Body: {{ .result.body }}
assertions:
- result.body ShouldContainSubstring connectors
- result.body ShouldContainSubstring identity
- result.body ShouldContainSubstring operate
- result.body ShouldContainSubstring optimize
- result.body ShouldContainSubstring tasklist
- result.body ShouldContainSubstring web-modeler-restapi
- result.body ShouldContainSubstring zeebe
- result.body ShouldContainSubstring zeebe-gateway
Loading

0 comments on commit 857349e

Please sign in to comment.