Skip to content
/ xk6-avro Public

k6 extension supporting avro textual and binary representations

Notifications You must be signed in to change notification settings

xvzf/xk6-avro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xk6-avro

CI

This extension wraps the goavro library into a k6 extension.

You can build the extension using:

xk6 build --with github.com/xvzf/xk6-avro

Example

import avro from "k6/x/avro"

const codec = avro.NewCodec(`{
  "type": "record",
  "name": "LongList",
  "fields" : [
    {"name": "next", "type": ["null", "LongList"], "default": null}
  ]
}`)
let binary = codec.binaryFromTextual(`{"next":{"LongList":{}}}`)
console.log(binary)

let textual = codec.textualFromBinary(binary)
console.log(textual)

// When actually doing an HTTP request using the k6 http client, data has to be passed as ArrayBuffer:
const binaryAB = new Uint8Array(binary).buffer
http.post(`https://example.com/avro-receiver`, binaryAB, {headers: {"Content-Type": "binary/avro"}})

About

k6 extension supporting avro textual and binary representations

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published