tests

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const UDF = `` /* 1771-byte string literal not displayed */

Variables

This section is empty.

Functions

func DirSize

func DirSize(path string) int64

DirSize returns the size, in bytes, of the directory specified by the given path.

func GetFileSizes

func GetFileSizes(dirName string) string

GetFileSizes builds and returns an info string containing information about file sizes under the specified dirName.

func Subtract

func Subtract(list1, list2 []*a.Record) (result []*a.Record)

Subtract returns a new list containing elements of list1 that are not contained in list2.

Types

type RecordMap

type RecordMap map[digest]*a.Record

RecordMap is a map of record digests to records. It is used to compare expected and actual records. The digest is a string representation of the record's key digest.

type TestClient

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

TestClient is a wrapper around the Aerospike client that provides convenience methods for testing.

func NewTestClient

func NewTestClient(asc *a.Client) *TestClient

NewTestClient creates a new TestClient.

func (*TestClient) DropSIndex

func (tc *TestClient) DropSIndex(namespace, set, name string) error

DropSIndex deletes a secondary index from the database.

func (*TestClient) DropUDF

func (tc *TestClient) DropUDF(name string) error

DropUDF deletes a UDF from the database.

func (*TestClient) ReadAllRecords

func (tc *TestClient) ReadAllRecords(namespace, set string) (RecordMap, error)

ReadAllRecords reads all records from the given namespace and set.

func (*TestClient) ReadAllSIndexes

func (tc *TestClient) ReadAllSIndexes(namespace string) ([]*models.SIndex, error)

ReadAllSIndexes reads all secondary indexes in the given namespace.

func (*TestClient) ReadAllUDFs

func (tc *TestClient) ReadAllUDFs() ([]*models.UDF, error)

ReadAllUDFs reads all UDFs in the database.

func (*TestClient) Truncate

func (tc *TestClient) Truncate(namespace, set string) error

Truncate deletes all records in the given namespace and set.

func (*TestClient) ValidateRecords

func (tc *TestClient) ValidateRecords(
	t assert.TestingT, expectedRecs []*a.Record, namespace, set string)

ValidateRecords compares the expected records to the actual records in the database. It fails if the number of records in the namespace and set does not match the length of the expected records, or if any unexpected records are found in the database. It does this by reading all records in the database namespace and set, then comparing their digests and bins to the expected records' digests and bins. Currently, it does not compare the records' metadata, only their digests and bins.

func (*TestClient) ValidateSIndexes

func (tc *TestClient) ValidateSIndexes(t assert.TestingT, expected []*models.SIndex, namespace string)

ValidateSIndexes compares the expected secondary indexes to the actual secondary indexes in the database.

func (*TestClient) WriteRecords

func (tc *TestClient) WriteRecords(recs []*a.Record) error

WriteRecords writes the given records to the database.

func (*TestClient) WriteSIndexes

func (tc *TestClient) WriteSIndexes(sindexes []*models.SIndex) error

WriteSIndexes writes a secondary index to the database.

func (*TestClient) WriteUDFs

func (tc *TestClient) WriteUDFs(udfs []*models.UDF) error

WriteUDFs writes a UDF to the database.

Jump to

Keyboard shortcuts

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