Documentation
¶
Overview ¶
Package setup implements a real env in which to run tests.
Index ¶
- Constants
- func CMD(flags ...string) func()
- func ClosableStandalone(config *ClusterConfig, path string, ports []int, flags ...string) (string, string, func())
- func ClosableStandaloneWithSchemaLoaders(config *ClusterConfig, path string, ports []int, schemaLoaders []SchemaLoader, ...) (string, string, func())
- func DataNode(config *ClusterConfig, flags ...string) func()
- func DataNodeFromDataDir(config *ClusterConfig, dataDir string, flags ...string) (string, string, func())
- func DataNodeWithAddrAndDir(config *ClusterConfig, flags ...string) (string, string, func())
- func EmptyClosableStandalone(config *ClusterConfig, path string, ports []int, flags ...string) (string, string, func())
- func EmptyStandalone(config *ClusterConfig, flags ...string) (string, string, func())
- func EmptyStandaloneWithAuth(config *ClusterConfig, username, password string, flags ...string) (string, string, func())
- func LiaisonNode(config *ClusterConfig, flags ...string) (grpcAddr string, closeFn func())
- func LiaisonNodeWithAddrAndDir(config *ClusterConfig, flags ...string) (string, string, func())
- func LiaisonNodeWithHTTP(config *ClusterConfig, flags ...string) (string, string, func())
- func PreloadSchemaViaEtcd(endpoint string, ...)
- func PreloadSchemaViaProperty(config *ClusterConfig, ...)
- func QueryNodeGroups(config *ClusterConfig) map[string][]string
- func Standalone(config *ClusterConfig, flags ...string) (string, string, func())
- func StandaloneWithAuth(config *ClusterConfig, username, password string, flags ...string) (string, string, func())
- func StandaloneWithSchemaLoaders(config *ClusterConfig, schemaLoaders []SchemaLoader, certFile, keyFile string, ...) (string, string, func())
- func StandaloneWithTLS(config *ClusterConfig, certFile, keyFile string, flags ...string) (string, string, func())
- func StartEmbeddedEtcd() (endpoint string, dir string, cleanup func())
- type ClusterConfig
- type DiscoveryFileWriter
- type NodeDiscoveryConfig
- type SchemaLoader
- type SchemaRegistryConfig
Constants ¶
const ( // ModeEtcd is the etcd mode for node discovery and schema registry. ModeEtcd = "etcd" // ModeFile is the file-based mode for node discovery. ModeFile = "file" // ModeProperty is the property-based mode for schema registry. ModeProperty = "property" // ModeNone is the none mode for node discovery (standalone). ModeNone = "none" )
Variables ¶
This section is empty.
Functions ¶
func ClosableStandalone ¶ added in v0.5.0
func ClosableStandalone(config *ClusterConfig, path string, ports []int, flags ...string) (string, string, func())
ClosableStandalone wires standalone modules to build a testing ready runtime.
func ClosableStandaloneWithSchemaLoaders ¶ added in v0.5.0
func ClosableStandaloneWithSchemaLoaders(config *ClusterConfig, path string, ports []int, schemaLoaders []SchemaLoader, flags ...string) (string, string, func())
ClosableStandaloneWithSchemaLoaders wires standalone modules to build a testing ready runtime.
func DataNode ¶ added in v0.5.0
func DataNode(config *ClusterConfig, flags ...string) func()
DataNode runs a data node.
func DataNodeFromDataDir ¶ added in v0.9.0
func DataNodeFromDataDir(config *ClusterConfig, dataDir string, flags ...string) (string, string, func())
DataNodeFromDataDir runs a data node with a specific data directory.
func DataNodeWithAddrAndDir ¶ added in v0.8.0
func DataNodeWithAddrAndDir(config *ClusterConfig, flags ...string) (string, string, func())
DataNodeWithAddrAndDir runs a data node and returns the address and root path.
func EmptyClosableStandalone ¶ added in v0.5.0
func EmptyClosableStandalone(config *ClusterConfig, path string, ports []int, flags ...string) (string, string, func())
EmptyClosableStandalone wires standalone modules to build a testing ready runtime.
func EmptyStandalone ¶ added in v0.5.0
func EmptyStandalone(config *ClusterConfig, flags ...string) (string, string, func())
EmptyStandalone wires standalone modules to build a testing ready runtime.
func EmptyStandaloneWithAuth ¶ added in v0.9.0
func EmptyStandaloneWithAuth(config *ClusterConfig, username, password string, flags ...string) (string, string, func())
EmptyStandaloneWithAuth wires standalone modules to build a testing ready runtime with Auth.
func LiaisonNode ¶ added in v0.5.0
func LiaisonNode(config *ClusterConfig, flags ...string) (grpcAddr string, closeFn func())
LiaisonNode runs a liaison node.
func LiaisonNodeWithAddrAndDir ¶ added in v0.10.0
func LiaisonNodeWithAddrAndDir(config *ClusterConfig, flags ...string) (string, string, func())
LiaisonNodeWithAddrAndDir runs a liaison node and returns the gRPC address, root data path, and closer.
func LiaisonNodeWithHTTP ¶ added in v0.9.0
func LiaisonNodeWithHTTP(config *ClusterConfig, flags ...string) (string, string, func())
LiaisonNodeWithHTTP runs a liaison node with HTTP enabled and returns the gRPC and HTTP addresses.
func PreloadSchemaViaEtcd ¶ added in v0.10.0
func PreloadSchemaViaEtcd(endpoint string, loaders ...func(ctx context.Context, registry schema.Registry) error)
PreloadSchemaViaEtcd creates an etcd schema registry and runs the provided schema loader functions.
func PreloadSchemaViaProperty ¶ added in v0.10.0
func PreloadSchemaViaProperty(config *ClusterConfig, loaders ...func(ctx context.Context, registry schema.Registry) error)
PreloadSchemaViaProperty connects to property schema servers and runs the provided schema loader functions.
func QueryNodeGroups ¶ added in v0.10.0
func QueryNodeGroups(config *ClusterConfig) map[string][]string
QueryNodeGroups returns active group names from each schema server.
func Standalone ¶ added in v0.5.0
func Standalone(config *ClusterConfig, flags ...string) (string, string, func())
Standalone wires standalone modules to build a testing ready runtime.
func StandaloneWithAuth ¶ added in v0.9.0
func StandaloneWithAuth(config *ClusterConfig, username, password string, flags ...string) (string, string, func())
StandaloneWithAuth wires standalone modules to build a testing ready runtime with Auth.
func StandaloneWithSchemaLoaders ¶ added in v0.5.0
func StandaloneWithSchemaLoaders(config *ClusterConfig, schemaLoaders []SchemaLoader, certFile, keyFile string, username, password string, flags ...string, ) (string, string, func())
StandaloneWithSchemaLoaders wires standalone modules to build a testing ready runtime. It also allows to preload schema.
func StandaloneWithTLS ¶ added in v0.5.0
func StandaloneWithTLS(config *ClusterConfig, certFile, keyFile string, flags ...string) (string, string, func())
StandaloneWithTLS wires standalone modules to build a testing ready runtime with TLS enabled.
func StartEmbeddedEtcd ¶ added in v0.10.0
StartEmbeddedEtcd starts an embedded etcd server and returns the endpoint, directory, and cleanup function.
Types ¶
type ClusterConfig ¶ added in v0.10.0
type ClusterConfig struct {
NodeDiscovery NodeDiscoveryConfig
SchemaRegistry SchemaRegistryConfig
EtcdEndpoint string
// contains filtered or unexported fields
}
ClusterConfig configures node discovery and schema registry for test clusters.
func EtcdClusterConfig ¶ added in v0.10.0
func EtcdClusterConfig(etcdEndpoint string) *ClusterConfig
EtcdClusterConfig creates a ClusterConfig that uses etcd for discovery and schema registry.
func PropertyClusterConfig ¶ added in v0.10.0
func PropertyClusterConfig(fileWriter *DiscoveryFileWriter) *ClusterConfig
PropertyClusterConfig creates a ClusterConfig that uses file-based discovery and property-based schema.
func (*ClusterConfig) AddLoadedKinds ¶ added in v0.10.0
func (c *ClusterConfig) AddLoadedKinds(kinds ...schema.Kind)
AddLoadedKinds records which schema kinds have been preloaded.
func (*ClusterConfig) NeedsEtcd ¶ added in v0.10.0
func (c *ClusterConfig) NeedsEtcd() bool
NeedsEtcd returns true if the config requires an embedded etcd server.
func (*ClusterConfig) SchemaServerAddrs ¶ added in v0.10.0
func (c *ClusterConfig) SchemaServerAddrs() []string
SchemaServerAddrs returns the accumulated schema server addresses.
type DiscoveryFileWriter ¶ added in v0.10.0
type DiscoveryFileWriter struct {
// contains filtered or unexported fields
}
DiscoveryFileWriter manages a dynamic YAML file for file-based node discovery.
func NewDiscoveryFileWriter ¶ added in v0.10.0
func NewDiscoveryFileWriter(dir string) *DiscoveryFileWriter
NewDiscoveryFileWriter creates a new DiscoveryFileWriter in the given directory.
func (*DiscoveryFileWriter) AddNode ¶ added in v0.10.0
func (w *DiscoveryFileWriter) AddNode(name, address string)
AddNode adds a node to the discovery file and writes it.
func (*DiscoveryFileWriter) Path ¶ added in v0.10.0
func (w *DiscoveryFileWriter) Path() string
Path returns the path to the discovery YAML file.
type NodeDiscoveryConfig ¶ added in v0.10.0
type NodeDiscoveryConfig struct {
FileWriter *DiscoveryFileWriter
Mode string // ModeEtcd (default), ModeFile, or ModeNone
}
NodeDiscoveryConfig configures node discovery mode.
type SchemaLoader ¶ added in v0.4.0
SchemaLoader is a service that can preload schema.
type SchemaRegistryConfig ¶ added in v0.10.0
type SchemaRegistryConfig struct {
Mode string // ModeEtcd (default) or ModeProperty
}
SchemaRegistryConfig configures schema registry mode.