htest

package
v0.0.0-...-7c66ffc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package htest contains test-related code.

Index

Constants

View Source
const (
	FirmwareID     = 1
	ManufacturerID = 2
	ModelID        = 4
	SerialID       = 3
)

Identifiers for the TLV buffers in the report from the device. The identifiers are held in the first byte then the length, then the payload.

Variables

View Source
var DefaultGeneratorSettings = GeneratorSettings{
	CollectionsPerTeam:   5,
	DevicesPerCollection: 10000,
	TeamsPerUser:         5,
	MembersPerTeam:       5,
	TokensPerUser:        3,
	InvitesPerUser:       3,
	OutputsPerCollection: 3,
	LogActivity:          false,
}

DefaultGeneratorSettings is the default generator settings to use. These are best guesses for the actual distribution of entities. Some might be too conservative and some might be too optimistic but if you generate 10K users you should get reasonable large data sets. The number of users is the deciding factor when generating data.

Functions

func CollectionCount

func CollectionCount(userCount int, settings GeneratorSettings) int

CollectionCount returns the number of collections generated based on the number of users and GeneratorSettings used

func DecodeSimpleFOTAResponse

func DecodeSimpleFOTAResponse(buf []byte) (fota.SimpleFOTAResponse, error)

DecodeSimpleFOTAResponse decodes a simple FOTA response

func DeviceCount

func DeviceCount(userCount int, settings GeneratorSettings) int

DeviceCount returns the number of collections given the number of users

func Generate

func Generate(userCount int, settings GeneratorSettings, store storage.DataStore) error

Generate generates a data set in a backend store. The size of the data set is determined by the number of users to generate. Multiply the number of

func MemberCount

func MemberCount(userCount int, settings GeneratorSettings) int

MemberCount returns the number of team members generated based on the number of users and GeneratorSettings used

func OutputCount

func OutputCount(userCount int, settings GeneratorSettings) int

OutputCount returns the number of collections given the number of users

func SendUDPWithSource

func SendUDPWithSource(destination string, source string, payload []byte) error

SendUDPWithSource (semi-) spoofs an UDP packet with a new source. The MAC address is unchanged. You must be root to call this

func TeamCount

func TeamCount(userCount int, settings GeneratorSettings) int

TeamCount returns the number of teams generated based on the number of users and GeneratorSettings used

func TokenCount

func TokenCount(userCount int, settings GeneratorSettings) int

TokenCount returns the number of teams generated based on the number of users and GeneratorSettings used

Types

type GeneratorSettings

type GeneratorSettings struct {
	CollectionsPerTeam   int
	DevicesPerCollection int
	TeamsPerUser         int
	MembersPerTeam       int
	TokensPerUser        int
	InvitesPerUser       int
	OutputsPerCollection int
	LogActivity          bool
}

GeneratorSettings holds parameters for the GenerateData function

type TLVBuffer

type TLVBuffer struct {
	// contains filtered or unexported fields
}

TLVBuffer is a type to decode TLV payloads

func NewTLVBuffer

func NewTLVBuffer(length int) *TLVBuffer

NewTLVBuffer creates a new TLV buffer

func (*TLVBuffer) Begin

func (t *TLVBuffer) Begin()

Begin starts encoding

func (*TLVBuffer) Buffer

func (t *TLVBuffer) Buffer() []byte

Buffer returns the encoded buffer

func (*TLVBuffer) EncodeTLVString

func (t *TLVBuffer) EncodeTLVString(id byte, value string)

EncodeTLVString encodes a string into a TLV buffer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL