veracitytesting

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTenantLog

func GenerateTenantLog(tc *mmrtesting.TestContext, g EventTestGenerator, eventTotal int, tenantID string, deleteBlobs bool, massifHeight uint8, leafType uint8) []*assets.EventResponse

GenerateTenantLog populates the tenants blob storage with deterministically generated

datatrails merklelog events as leaf nodes, and populates the rest of the mmr from these leaf nodes.

Returns the list of generated events with the correct merklelog data.

NOTE: deletes all pre-existing blobs for the given tenant first. NOTE: Will only populate the first massif. NOTE: No Range checks are performed if you go out of the first massif.

Types

type EventTestGenerator

type EventTestGenerator struct {
	mmrtesting.TestGenerator

	LeafHasher leafHasher
	IdState    *snowflakeid.IDState
	// contains filtered or unexported fields
}

Create random values of various sorts for testing. Seeded so that from run to run the values are the same. Intended for white box tests that benefit from a large volume of synthetic data.

func NewAzuriteTestContext

func NewAzuriteTestContext(
	t *testing.T,
	testLabelPrefix string,
) (mmrtesting.TestContext, EventTestGenerator, mmrtesting.TestConfig)

func NewEventTestGenerator

func NewEventTestGenerator(
	t *testing.T, seed int64,
	leafHasher leafHasher,
	cfg mmrtesting.TestGeneratorConfig) EventTestGenerator

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 (*EventTestGenerator) GenerateEventBatch

func (g *EventTestGenerator) GenerateEventBatch(count int) []*assets.EventResponse

func (*EventTestGenerator) GenerateLeaf

func (g *EventTestGenerator) GenerateLeaf(tenantIdentity string, base, i uint64) mmrtesting.AddLeafArgs

func (*EventTestGenerator) GenerateNextEvent

func (g *EventTestGenerator) GenerateNextEvent(tenantIdentity string) *assets.EventResponse

func (*EventTestGenerator) GenerateTenantEventMessageBatch

func (g *EventTestGenerator) GenerateTenantEventMessageBatch(tenantIdentity string, count int) []*azbus.ReceivedMessage

func (*EventTestGenerator) NewAssetIdentity

func (g *EventTestGenerator) NewAssetIdentity() string

func (*EventTestGenerator) NewEventIdentity

func (g *EventTestGenerator) NewEventIdentity(assetUUID string) string

func (*EventTestGenerator) NextId

func (g *EventTestGenerator) NextId() (uint64, error)

func (*EventTestGenerator) PadWithLeafEntries

func (g *EventTestGenerator) PadWithLeafEntries(data []byte, n int) []byte

PadWithLeafEntries pads the given mmr (data) with the given number of leaves (n).

Each leaf is a hash of a deterministically generated event.

type LeafHasher

type LeafHasher struct {
	simplehash.HasherV3
}

func NewLeafHasher

func NewLeafHasher() LeafHasher

Jump to

Keyboard shortcuts

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