Documentation
¶
Overview ¶
Package htest contains test-related code.
Index ¶
- Constants
- Variables
- func CollectionCount(userCount int, settings GeneratorSettings) int
- func DecodeSimpleFOTAResponse(buf []byte) (fota.SimpleFOTAResponse, error)
- func DeviceCount(userCount int, settings GeneratorSettings) int
- func Generate(userCount int, settings GeneratorSettings, store storage.DataStore) error
- func MemberCount(userCount int, settings GeneratorSettings) int
- func OutputCount(userCount int, settings GeneratorSettings) int
- func SendUDPWithSource(destination string, source string, payload []byte) error
- func TeamCount(userCount int, settings GeneratorSettings) int
- func TokenCount(userCount int, settings GeneratorSettings) int
- type GeneratorSettings
- type TLVBuffer
Constants ¶
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 ¶
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 ¶
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 (*TLVBuffer) EncodeTLVString ¶
EncodeTLVString encodes a string into a TLV buffer