test

package
v0.3.1-alpha.2 Latest Latest
Warning

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

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

Documentation

Overview

Package test implements a mock namespace reflection and namespace translation mechanism

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeReflectionManager added in v0.3.1

type FakeReflectionManager struct {
	Started map[string]int
	Stopped map[string]int
}

FakeReflectionManager implements a fake ReflectionManager for testing purposes.

func NewFakeReflectionManager added in v0.3.1

func NewFakeReflectionManager() *FakeReflectionManager

NewFakeReflectionManager returns a new FakeReflectionManager.

func (*FakeReflectionManager) StartNamespace added in v0.3.1

func (f *FakeReflectionManager) StartNamespace(local, _ string)

StartNamespace increments the Started counter for the given namespace.

func (*FakeReflectionManager) StopNamespace added in v0.3.1

func (f *FakeReflectionManager) StopNamespace(local, _ string)

StopNamespace increments the Stopped counter for the given namespace.

type MockNamespaceMapper

type MockNamespaceMapper struct {
	Cache map[string]string
}

MockNamespaceMapper implements a mock namespace mapping mechanism.

func (*MockNamespaceMapper) Clear

func (m *MockNamespaceMapper) Clear()

Clear is a function used in tests only to clear the mock's state.

func (*MockNamespaceMapper) DeNatNamespace

func (m *MockNamespaceMapper) DeNatNamespace(namespace string) (string, error)

DeNatNamespace handle the foreign to home namespace translation. It returns an error if the mapping is not found.

func (*MockNamespaceMapper) MappedNamespaces

func (m *MockNamespaceMapper) MappedNamespaces() map[string]string

MappedNamespaces returns the entire namespace mapping map.

func (*MockNamespaceMapper) NatNamespace

func (m *MockNamespaceMapper) NatNamespace(namespace string) (string, error)

NatNamespace handle the home to foreign namespace translation. It returns an error if the mapping is not found.

func (*MockNamespaceMapper) NewNamespace

func (m *MockNamespaceMapper) NewNamespace(namespace string)

NewNamespace creates a new namespace in the local cache.

type MockNamespaceMapperController

type MockNamespaceMapperController struct {
	Mapper *MockNamespaceMapper
}

MockNamespaceMapperController implements a mock namespace mapper controller.

func NewMockNamespaceMapperController

func NewMockNamespaceMapperController(mapper *MockNamespaceMapper) *MockNamespaceMapperController

NewMockNamespaceMapperController builds and returns a new mock NewNamespaceMapperController.

func (*MockNamespaceMapperController) DeNatNamespace

func (c *MockNamespaceMapperController) DeNatNamespace(namespace string) (string, error)

DeNatNamespace handle the foreign to home namespace translation. It returns an error if the mapping is not found.

func (*MockNamespaceMapperController) MappedNamespaces

func (c *MockNamespaceMapperController) MappedNamespaces() map[string]string

MappedNamespaces returns the entire namespace mapping map.

func (*MockNamespaceMapperController) NatNamespace

func (c *MockNamespaceMapperController) NatNamespace(namespace string) (string, error)

NatNamespace handle the home to foreign namespace translation. It returns an error if the mapping is not found.

func (*MockNamespaceMapperController) PollStartIncomingReflection

func (c *MockNamespaceMapperController) PollStartIncomingReflection() chan string

PollStartIncomingReflection returns the startIncomingReflection channel. It is used to receive elements to start new incoming reflection routines on pushed namespace names.

func (*MockNamespaceMapperController) PollStartMapper

func (c *MockNamespaceMapperController) PollStartMapper() chan struct{}

PollStartMapper returns the startMapper channel.

func (*MockNamespaceMapperController) PollStartOutgoingReflection

func (c *MockNamespaceMapperController) PollStartOutgoingReflection() chan string

PollStartOutgoingReflection returns the startOutgoingReflection channel. It is used to receive elements to start new outgoing reflection routines on pushed namespace names.

func (*MockNamespaceMapperController) PollStopIncomingReflection

func (c *MockNamespaceMapperController) PollStopIncomingReflection() chan string

PollStopIncomingReflection returns the stopIncomingReflection channel. It is used to receive elements to stop new incoming reflection routines on pushed namespace names.

func (*MockNamespaceMapperController) PollStopMapper

func (c *MockNamespaceMapperController) PollStopMapper() chan struct{}

PollStopMapper returns the stopMapper channel.

func (*MockNamespaceMapperController) PollStopOutgoingReflection

func (c *MockNamespaceMapperController) PollStopOutgoingReflection() chan string

PollStopOutgoingReflection returns the stopOutgoingReflectionMapper channel. It is used to receive elements to stop new outgoing reflection routines on pushed namespace names.

func (*MockNamespaceMapperController) ReadyForRestart

func (c *MockNamespaceMapperController) ReadyForRestart()

ReadyForRestart emits a signal to restart the OutgoingReflection.

func (*MockNamespaceMapperController) WaitForSync

func (c *MockNamespaceMapperController) WaitForSync()

WaitForSync waits until internal caches are synchronized.

Jump to

Keyboard shortcuts

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