st-tech / gatling-operator

Automating distributed Gatling load testing using Kubernetes operator
MIT License
70 stars 19 forks source link

Support Additional printer columns for Gatling CR #66

Closed yokawasa closed 1 year ago

yokawasa commented 1 year ago

Description

Support Additional printer columns for Gatling CR so that useful Gatling status will be displayed with kubectl get gatling <name> command

For example, currently kubectl get gatling <name> only display like this:

kubectl get gatling gatling-sample01

NAME               AGE
gatling-sample01   97m

With this update, kubectl get gatling <name> will display like this (more useful information for users):

NAME               RUNNED   REPORTED   NOTIFIED   REPORTURL                                                                                 AGE
gatling-sample01   3/3      true       true       https://my-test-report.s3.amazonaws.com/gatling-sample01/3499717572/index.html   3m50s

Testing

case1: runner of parallelism 3 with no report + no notification pattern

  1. prepare testing Gatling CR where reporting is enabled

base gatling CR is this.

config/samples/gatling-operator_v1alpha1_gatling01.yaml

apiVersion: gatling-operator.tech.zozo.com/v1alpha1
kind: Gatling
metadata:
  name: gatling-sample01
spec:
  generateReport: false
  generateLocalReport: false
  notifyReport: false
  cleanupAfterJobDone: false

apply the manifest and see the result


# apply the manifest
kustomize build config/samples  | kubectl apply -f -

# check the gatling cr and it's status
kubectl get gatling gatling-sample01
kubectl get gatling gatling-sample01 -o jsonpath='{@.status}' |jq

Check if new additional printer columns are displayed

kubectl get gatling gatling-sample01

NAME               RUNNED   REPORTED   NOTIFIED   REPORTURL                                                                                 AGE
gatling-sample01   3/3                            https://my-test-reports-0001.s3.amazonaws.com/gatling-sample01/3499717572/index.html   2m59s

Check if runnerCompletions field is added in Gatling CR status

kubectl get gatling gatling-sample01 -o jsonpath='{@.status}' |jq

{
  "reportStoragePath": "s3:my-test-reports-0001/gatling-sample01/3499717572",
  "reportUrl": "https://my-test-reports-0001.s3.amazonaws.com/gatling-sample01/3499717572/index.html",
  "reporterJobName": "gatling-sample01-reporter",
  "reporterStartTime": 1669533890,
  "runnerCompleted": true,
  "runnerCompletions": "3/3",
  "runnerJobName": "gatling-sample01-runner",
  "runnerStartTime": 1669533727,
  "succeeded": 3
}

case2: Runner of parallelism 3 with report + notification pattern

base gatling CR is this.

config/samples/gatling-operator_v1alpha1_gatling01.yaml

apiVersion: gatling-operator.tech.zozo.com/v1alpha1
kind: Gatling
metadata:
  name: gatling-sample01
spec:
  generateReport: true
  generateLocalReport: false
  notifyReport: true
  cleanupAfterJobDone: false

apply the manifest and see the result


# apply the manifest
kustomize build config/samples  | kubectl apply -f -

# check the gatling cr and it's status
kubectl get gatling gatling-sample01
kubectl get gatling gatling-sample01 -o jsonpath='{@.status}' |jq

Check if new additional printer columns are displayed

kubectl get gatling gatling-sample01

NAME               RUNNED   REPORTED   NOTIFIED   REPORTURL                                                                                 AGE
gatling-sample01   3/3      true       true       https://my-test-report-0001.s3.amazonaws.com/gatling-sample01/3499717572/index.html   3m50s

Check if runnerCompletions field is added in Gatling CR status

kubectl get gatling gatling-sample01 -o jsonpath='{@.status}' |jq

{
  "reportCompleted": true,
  "reportStoragePath": "s3:my-gatling-reports-0001/gatling-sample01/3499717572",
  "reportUrl": "https://my-gatling-reports-0001.s3.amazonaws.com/gatling-sample01/3499717572/index.html",
  "reporterJobName": "gatling-sample01-reporter",
  "reporterStartTime": 1669533890,
  "runnerCompleted": true,
  "runnerCompletions": "3/3",
  "runnerJobName": "gatling-sample01-runner",
  "runnerStartTime": 1669533727,
  "NotificationCompleted": true,
  "succeeded": 3
}

Checklist

Please check if applicable

Relevant issue #

https://github.com/st-tech/gatling-operator/issues/50

yokawasa commented 1 year ago

@akitok @ksudate thanks much for the review!!