项目作者: olvod

项目描述 :
A k6 extension for Google PubSub.
高级语言: Go
项目地址: git://github.com/olvod/xk6-pubsub.git
创建时间: 2021-03-17T06:22:52Z
项目社区:https://github.com/olvod/xk6-pubsub

开源协议:

下载


xk6-pubsub

This is a k6 extension using the xk6 system.

:exclamation: This is a proof of concept, isn’t supported by the k6 team, and may break in the future. USE AT YOUR OWN RISK!

Build

To build a k6 binary with this extension, first ensure you have the prerequisites:

  1. Install xk6 framework for extending k6:

    1. go install github.com/k6io/xk6/cmd/xk6@latest
  2. Build the binary:

    1. #Required by Pub/Sub client
    2. export CGO_ENABLED=1
    1. xk6 build --with github.com/olvod/xk6-pubsub@latest

xk6 build —with github.com/k6io/xk6-redis=”/Users/avpretty/pr/xk6-pubsub”

  1. Setup Google Pub/Sub configuration via environment variables:
    1. export PUBSUB_PROJECT_ID=<project_id>
    2. export PUBSUB_CREDENTIALS=<credentials>

Or use PubSub emulator for local development
PUBSUB_EMULATOR_HOST environment variable must be present.

  1. export PUBSUB_EMULATOR_HOST=<emulator_host>

Example

  1. ./k6 run example.js

Result output:

  1. /\ |‾‾| /‾‾/ /‾‾/
  2. /\ / \ | |/ / / /
  3. / \/ \ | ( / ‾‾\
  4. / \ | |\ \ | (‾) |
  5. / __________ \ |__| \__\ \_____/ .io
  6. execution: local
  7. script: example.js
  8. output: -
  9. scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
  10. * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
  11. [watermill] 2021/03/17 22:17:04.450779 publisher.go:116: level=TRACE msg="Sending message to Google PubSub" message_uuid=Y3mriTgx4SuWo2ZxMgg8FF topic=topic_name
  12. [watermill] 2021/03/17 22:17:04.464942 publisher.go:131: level=TRACE msg="Message published to Google PubSub" message_uuid=Y3mriTgx4SuWo2ZxMgg8FF topic=topic_name
  13. [watermill] 2021/03/17 22:17:04.465082 publisher.go:139: level=INFO msg="Closing Google PubSub publisher"
  14. [watermill] 2021/03/17 22:17:04.465128 publisher.go:153: level=INFO msg="Google PubSub publisher closed"
  15. running (00m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
  16. default [======================================] 1 VUs 00m00.0s/10m0s 1/1 iters, 1 per VU
  17. is sent
  18. checks...............: 100.00% 1 0
  19. data_received........: 0 B 0 B/s
  20. data_sent............: 0 B 0 B/s
  21. iteration_duration...: avg=27.14ms min=27.14ms med=27.14ms max=27.14ms p(90)=27.14ms p(95)=27.14ms
  22. iterations...........: 1 35.356928/s