tests

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

README

This directory contains tests that require the sql package, together with common SQL test code.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEndTxnTrigger

func CheckEndTxnTrigger(args kvserverbase.FilterArgs) *roachpb.Error

CheckEndTxnTrigger verifies that an EndTxnRequest that includes intents for the SystemDB keys sets the proper trigger.

TODO(ajwerner): Remove this in 22.2. It only applies to the mixed-version state.

func CheckKeyCount

func CheckKeyCount(t *testing.T, kvDB *kv.DB, span roachpb.Span, numKeys int)

CheckKeyCount checks that the number of keys in the provided span matches numKeys.

func CheckKeyCountE

func CheckKeyCountE(t *testing.T, kvDB *kv.DB, span roachpb.Span, numKeys int) error

CheckKeyCountE returns an error if the the number of keys in the provided span does not match numKeys.

func CreateKVTable

func CreateKVTable(sqlDB *gosql.DB, name string, numRows int) error

CreateKVTable creates a basic table named t.<name> that stores key/value pairs with numRows of arbitrary data.

func CreateTestTenantParams

func CreateTestTenantParams(tenantID roachpb.TenantID) base.TestTenantArgs

CreateTestTenantParams creates a set of params suitable for SQL Tenant Tests.

func CreateTestingKnobs

func CreateTestingKnobs() base.TestingKnobs

CreateTestingKnobs creates a testing knob in the unit tests.

Types

type CommandFilters

type CommandFilters struct {
	syncutil.RWMutex
	// contains filtered or unexported fields
}

CommandFilters provides facilities for registering "TestingCommandFilters" (i.e. functions to be run on every replica command). CommandFilters is thread-safe. CommandFilters also optionally does replay protection if filters need it.

func CreateTestServerParams

func CreateTestServerParams() (base.TestServerArgs, *CommandFilters)

CreateTestServerParams creates a set of params suitable for SQL tests. It enables some EndTxn sanity checking and installs a flexible TestingEvalFilter. TODO(andrei): this function is not used consistently by SQL tests. Figure out if the EndTxn checks are important.

func (*CommandFilters) AppendFilter

func (c *CommandFilters) AppendFilter(
	filter kvserverbase.ReplicaCommandFilter, idempotent bool,
) func()

AppendFilter registers a filter function to run after all the previously registered filters. idempotent specifies if this filter can be safely run multiple times on the same command. If this property doesn't hold, CommandFilters will start tracking commands for replay protection, which might be expensive. Returns a closure that the client must run for doing cleanup when the filter should be deregistered.

func (*CommandFilters) RunFilters

func (c *CommandFilters) RunFilters(args kvserverbase.FilterArgs) *roachpb.Error

RunFilters executes the registered filters, stopping at the first one that returns an error.

Jump to

Keyboard shortcuts

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