Documentation ¶
Index ¶
- Constants
- func HashWriteUint64(hasher hash.Hash, value uint64)
- type AddLeafArgs
- type LeafGenerator
- type TestCallCounter
- type TestConfig
- type TestContext
- type TestGenerator
- func (g *TestGenerator) Float32() float32
- func (g *TestGenerator) GenerateLeafBatch(tenantIdentity string, base, count uint64, gf LeafGenerator) []AddLeafArgs
- func (g *TestGenerator) GenerateNumberedLeafBatch(tenantIdentity string, base, count uint64) []AddLeafArgs
- func (g *TestGenerator) Intn(n int) int
- func (g *TestGenerator) MultiWordString(count int) string
- func (g *TestGenerator) NewRandomUUID() (uuid.UUID, error)
- func (g *TestGenerator) NewRandomUUIDString(t *testing.T) string
- func (g *TestGenerator) NewTenantIdentity() string
- func (c *TestGenerator) PadWithLeafEntries(data []byte, n int) []byte
- func (c *TestGenerator) PadWithNumberedLeaves(data []byte, first, n int) []byte
- func (g *TestGenerator) SinceJitter(lastTime time.Time) time.Time
- func (g *TestGenerator) SinceLastJitter(noUpdate ...bool) time.Time
- func (g *TestGenerator) WordList(count int) []string
- type TestGeneratorConfig
- type TestSendCallCounter
Constants ¶
const ( ValueBytes = 32 V1MMRPrefix = "v1/mmrs" V1MMRBlobNameFmt = "%016d.log" )
XXX: TODO TenantMassifPrefix duplicated here to avoid import cycle. refactor
const (
DefaultGeneratorTenantIdentity = "tenant/0684984b-654d-4301-ad10-a508126e187d"
)
Variables ¶
This section is empty.
Functions ¶
func HashWriteUint64 ¶
Types ¶
type AddLeafArgs ¶
AddLeafArgs is the return value of all LeafGenerator implementations. It carries just enough to successfully call AddLeafEntry on a MassifContext The leaf generator is free to decide on appropriate values
type LeafGenerator ¶
type LeafGenerator func(tenantIdentity string, base, i uint64) AddLeafArgs
type TestCallCounter ¶
func (*TestCallCounter) IncMethodCall ¶
func (r *TestCallCounter) IncMethodCall(name string) int
func (*TestCallCounter) MethodCallCount ¶
func (r *TestCallCounter) MethodCallCount(name string) int
func (*TestCallCounter) Reset ¶
func (r *TestCallCounter) Reset()
type TestConfig ¶
type TestConfig struct { // We seed the RNG of the provided StartTimeMS. It is normal to force it to // some fixed value so that the generated data is the same from run to run. StartTimeMS int64 EventRate int TestLabelPrefix string TenantIdentity string // can be "" Container string // can be "" defaults to TestLablePrefix DebugLevel string // defaults to INFO }
type TestContext ¶
func NewTestContext ¶
func NewTestContext(t *testing.T, cfg TestConfig) TestContext
func (*TestContext) DeleteBlobsByPrefix ¶
func (c *TestContext) DeleteBlobsByPrefix(blobPrefixPath string)
func (*TestContext) GetLog ¶
func (c *TestContext) GetLog() logger.Logger
func (*TestContext) GetStorer ¶
func (c *TestContext) GetStorer() *azblob.Storer
func (*TestContext) NewStorer ¶
func (c *TestContext) NewStorer() *azblob.Storer
type TestGenerator ¶
type TestGenerator struct { Cfg TestGeneratorConfig T *testing.T StartTime time.Time LastTime time.Time // contains filtered or unexported fields }
Create random values of various sorts for testing. Seeded so that from run to run the values can be the same. Intended for white box tests that benefit from a large volume of synthetic data.
func NewTestGenerator ¶
func NewTestGenerator(t *testing.T, seed int64, cfg TestGeneratorConfig, leafGenerator LeafGenerator) TestGenerator
NewTestGenerator creates a deterministic, but random looking, test data generator. Given the same seed, the series of data generated on different runs is identical. This means that we generate valid values for things like uuid based identities and simulated time stamps, but the log telemetry from successive runs will be usefuly stable.
func (*TestGenerator) Float32 ¶
func (g *TestGenerator) Float32() float32
func (*TestGenerator) GenerateLeafBatch ¶
func (g *TestGenerator) GenerateLeafBatch(tenantIdentity string, base, count uint64, gf LeafGenerator) []AddLeafArgs
func (*TestGenerator) GenerateNumberedLeafBatch ¶
func (g *TestGenerator) GenerateNumberedLeafBatch(tenantIdentity string, base, count uint64) []AddLeafArgs
func (*TestGenerator) Intn ¶
func (g *TestGenerator) Intn(n int) int
func (*TestGenerator) MultiWordString ¶
func (g *TestGenerator) MultiWordString(count int) string
func (*TestGenerator) NewRandomUUID ¶
func (g *TestGenerator) NewRandomUUID() (uuid.UUID, error)
func (*TestGenerator) NewRandomUUIDString ¶
func (g *TestGenerator) NewRandomUUIDString(t *testing.T) string
func (*TestGenerator) NewTenantIdentity ¶
func (g *TestGenerator) NewTenantIdentity() string
func (*TestGenerator) PadWithLeafEntries ¶
func (c *TestGenerator) PadWithLeafEntries(data []byte, n int) []byte
func (*TestGenerator) PadWithNumberedLeaves ¶
func (c *TestGenerator) PadWithNumberedLeaves(data []byte, first, n int) []byte
func (*TestGenerator) SinceJitter ¶
func (g *TestGenerator) SinceJitter(lastTime time.Time) time.Time
func (*TestGenerator) SinceLastJitter ¶
func (g *TestGenerator) SinceLastJitter(noUpdate ...bool) time.Time
func (*TestGenerator) WordList ¶
func (g *TestGenerator) WordList(count int) []string
WordList returns a list of random words selected from the table
type TestGeneratorConfig ¶
type TestSendCallCounter ¶
type TestSendCallCounter struct {
TestCallCounter
}
func (*TestSendCallCounter) Close ¶
func (s *TestSendCallCounter) Close(context.Context)
func (*TestSendCallCounter) GetAZClient ¶
func (s *TestSendCallCounter) GetAZClient() azbus.AZClient
func (*TestSendCallCounter) Open ¶
func (s *TestSendCallCounter) Open() error
func (*TestSendCallCounter) Send ¶
func (s *TestSendCallCounter) Send(ctx context.Context, msg *azbus.OutMessage) error
func (*TestSendCallCounter) String ¶
func (s *TestSendCallCounter) String() string