mongotest

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ScenarioTestDatabase = "qst"
View Source
const (
	ScenarioTestFileExt = "qst"
)
View Source
const (
	SuiteDefaultTestDirectory = "./test"
)

Variables

This section is empty.

Functions

func ExecYCSB

func ExecYCSB(t *testing.T)

func ExecYCSBWorkload

func ExecYCSBWorkload(t *testing.T, workload string)

func RunClientTest added in v0.9.4

func RunClientTest(t *testing.T)

func RunEmbedSuite added in v0.9.4

func RunEmbedSuite(t *testing.T) error

func RunLocalSuite added in v0.9.4

func RunLocalSuite(t *testing.T)

func RunScenarioTestFiles added in v0.9.4

func RunScenarioTestFiles(t *testing.T, testFilenames []string)

func YCSBTest added in v0.9.2

func YCSBTest(t *testing.T)

Types

type Client added in v0.9.4

type Client interface {
	SetHost(host string)
	SetPort(port int)
	Open() error
	Close() error
	Query(query string) (any, error)
}

Client represents a client for testing.

type Line added in v0.9.4

type Line = string

Line represents a line of a scenario test file.

type Scenario added in v0.9.4

type Scenario struct {
	Filename  string
	Queries   []string
	Expecteds []any
}

Scenario represents a scenario.

func NewScenario added in v0.9.4

func NewScenario() *Scenario

NewScenario return a scenario instance.

func NewScenarioWithBytes added in v0.9.4

func NewScenarioWithBytes(name string, b []byte) (*Scenario, error)

NewScenarioWithBytes return a scenario instance for the specified test scenario bytes.

func NewScenarioWithFile added in v0.9.4

func NewScenarioWithFile(filename string) (*Scenario, error)

NewScenarioWithFile return a scenario instance for the specified test scenario file.

func (*Scenario) IsValid added in v0.9.4

func (scn *Scenario) IsValid() error

IsValid checks whether the loaded scenario is available.

func (*Scenario) LoadFile added in v0.9.4

func (scn *Scenario) LoadFile(filename string) error

LoadFile loads the specified scenario.

func (*Scenario) Name added in v0.9.4

func (scn *Scenario) Name() string

Name returns the loaded scenario file name.

func (*Scenario) ParseBytes added in v0.9.4

func (scn *Scenario) ParseBytes(name string, b []byte) error

ParseBytes parses the specified scenario bytes.

func (*Scenario) ParseLineStrings added in v0.9.4

func (scn *Scenario) ParseLineStrings(lines []string) error

ParseLineStrings parses the specified scenario line strings.

func (*Scenario) String added in v0.9.4

func (scn *Scenario) String() string

String returns the string representation.

type ScenarioTest added in v0.9.4

type ScenarioTest struct {
	Scenario *Scenario
	// contains filtered or unexported fields
}

ScenarioTest represents a scenario test.

func NewScenarioTest added in v0.9.4

func NewScenarioTest() *ScenarioTest

NewScenarioTest returns a scenario test instance.

func NewScenarioTestWithBytes added in v0.9.4

func NewScenarioTestWithBytes(name string, b []byte) (*ScenarioTest, error)

NewScenarioTestWithBytes return a scenario test instance for the specified test scenario bytes.

func NewScenarioTestWithFile added in v0.9.4

func NewScenarioTestWithFile(filename string) (*ScenarioTest, error)

NewScenarioTestWithFile return a scenario test instance for the specified test scenario file.

func (*ScenarioTest) LoadFile added in v0.9.4

func (tst *ScenarioTest) LoadFile(filename string) error

LoadFile loads a specified scenario test file.

func (*ScenarioTest) LoadFileWithBasename added in v0.9.4

func (tst *ScenarioTest) LoadFileWithBasename(basename string) error

LoadFileWithBasename loads a scenario test file which has specified basename.

func (*ScenarioTest) Name added in v0.9.4

func (tst *ScenarioTest) Name() string

Name returns the loaded senario name.

func (*ScenarioTest) ParseBytes added in v0.9.4

func (tst *ScenarioTest) ParseBytes(name string, b []byte) error

ParseBytes loads a specified scenario test bytes.

func (*ScenarioTest) Run added in v0.9.4

func (tst *ScenarioTest) Run() error

Run runs a loaded scenario test.

func (*ScenarioTest) SetClient added in v0.9.4

func (tst *ScenarioTest) SetClient(c Client)

SetClient sets a client for testing.

type Server

type Server struct {
	*server.Server
}

func NewServer

func NewServer() *Server

NewServer returns a test server instance.

type Suite added in v0.9.4

type Suite struct {
	Tests []*ScenarioTest
	// contains filtered or unexported fields
}

Suite represents a scenario test suite.

func NewSuite added in v0.9.4

func NewSuite() *Suite

NewSuite returns a scenario test suite instance.

func NewSuiteWithDirectory added in v0.9.4

func NewSuiteWithDirectory(dir string) (*Suite, error)

NewSuiteWithDirectory returns a scenario test suite instance which loads under the specified directory.

func NeweEmbedSuite added in v0.9.4

func NeweEmbedSuite(tests map[string][]byte) (*Suite, error)

NeweEmbedSuite returns a scenario test suite instance which loads under the specified directory.

func (*Suite) Run added in v0.9.4

func (suite *Suite) Run() error

Run runs all loaded scenario tests. The method stops the testing when a scenario test is aborted, and the following tests are not run.

func (*Suite) SetClient added in v0.9.4

func (suite *Suite) SetClient(c Client)

SetClient sets a client for testing.

type Trainer

type Trainer struct {
	Name string
	Age  int
	City string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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