config

package
v0.0.0-...-efb2c3d Latest Latest
Warning

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

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

Documentation

Overview

Package config provides functionality for handling and validating configuration data for test execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompareResult

type CompareResult struct {
	ExpectedFail map[string]string
	ExpectedSkip map[string]string
	ExpectedPass map[string]string

	UnexpectedFail map[string]string
	UnexpectedSkip map[string]string
	UnexpectedPass map[string]string

	UnexpectedRest map[string]TestResult

	Stats Stats
}

CompareResult encapsulates the comparison between expected and actual test outcomes.

type Config

type Config struct {
	Runner RunnerType
	Dir    string
	// Args contains additional arguments for the test runner.
	Args    []string
	Results Results
}

Config represents the configuration settings for the test execution.

func (*Config) ForDB

func (c *Config) ForDB(dbName string) (*TestConfig, error)

ForDB returns the database-specific test configuration based on the provided dbName.

type Results

type Results struct {
	PostgreSQL *TestConfig
	SQLite     *TestConfig
	MongoDB    *TestConfig
}

Results stores the expected test results for different databases.

type RunnerType

type RunnerType string

RunnerType represents the type of test runner used in the configuration.

const (
	// RunnerTypeCommand indicates a command-line test runner.
	RunnerTypeCommand RunnerType = "command"

	// RunnerTypeGoTest indicates a Go test runner.
	RunnerTypeGoTest RunnerType = "gotest"

	// RunnerTypeJSTest indicates a JavaScript test runner.
	RunnerTypeJSTest RunnerType = "jstest"

	// RunnerTypeYCSB indicates a YCSB test runner.
	RunnerTypeYCSB RunnerType = "ycsb"
)

type Stats

type Stats struct {
	UnexpectedFail int
	UnexpectedSkip int
	UnexpectedPass int
	UnexpectedRest int
	ExpectedFail   int
	ExpectedSkip   int
	ExpectedPass   int
}

Stats represent the expected/actual amount of failed, skipped and passed tests. The ordering is significant and ordering improves readability, so please maintain it.

type Status

type Status string

Status represents the status of a single test.

const (
	Fail    Status = "fail"
	Skip    Status = "skip"
	Pass    Status = "pass"
	Ignore  Status = "ignore"  // for fluky tests
	Unknown Status = "unknown" // result can't be parsed
)

Constants representing different test statuses.

type TestConfig

type TestConfig struct {
	Default Status
	Stats   *Stats
	Fail    Tests
	Skip    Tests
	Pass    Tests
	Ignore  Tests
}

TestConfig represents the configuration for tests categorized by status and regular expressions.

func (*TestConfig) Compare

func (tc *TestConfig) Compare(results *TestResults) (*CompareResult, error)

Compare compares two *TestResults and returns a *CompareResult containing the differences.

type TestResult

type TestResult struct {
	Status Status
	Output string
}

TestResult represents the outcome of a single test.

func (*TestResult) IndentedOutput

func (tr *TestResult) IndentedOutput() string

IndentedOutput returns the output of a test result with indented lines.

type TestResults

type TestResults struct {
	// Test results by full test name.
	TestResults map[string]TestResult
}

TestResults represents the collection of results from multiple tests.

type Tests

type Tests struct {
	Names []string // names (i.e. "go.mongodb.org/mongo-driver/mongo/...")
}

Tests holds information about tests of a specific status (fail, skip, pass).

Jump to

Keyboard shortcuts

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