上传gatling报表到s3



我正在集群中运行一些压力测试。我在一个jar中编译Gatling代码,并在dockerized的环境中运行它。同样,我想知道是否有办法将最终的Gatling报告上传到S3。在Gatling模拟类中有after钩子,但我认为这是在生成报告之前执行的。

我认为在不改变gatling代码或jar的情况下做到这一点的简单方法是:

  • 使运行测试的docker容器作为init容器运行
  • init容器运行后,一个主容器启动并可以使用bash命令或其他方法(例如,使用tinys3 - https://github.com/smore-inc/tinys3)进行s3上传

只是一个一般的例子:

apiVersion: v1
kind: Pod
metadata:
labels:
app.kubernetes.io/instance: gatling-stress-test
app.kubernetes.io/name: gatling-stress-test
name: gatling-stress-test
spec:
initContainers:
- name: gatling-stress-test-runner
image: gatling-docker-image:latest
imagePullPolicy: Always
volumeMounts:
- mountPath: /full/path/to/gatling/reports
name: reports
containers:
- name: stress-test-s3-copier
image: ubuntu-image-with-tinys3:latest
imagePullPolicy: Always
volumeMounts:
- mountPath: /full/path/to/gatling/reports
name: reports
volumes:
- emptyDir: {}
name: reports

最新更新