Documentation ¶
Index ¶
- type Option
- func NumMetadataRepositoryNodes(numMetaReposNodes int32) Option
- func NumStorageNodes(numStorageNodes int32) Option
- func WithAdminServiceResourceName(serviceName string) Option
- func WithAsyncTestCheckInterval(asyncTestCheckInterval time.Duration) Option
- func WithAsyncTestWaitDuration(asyncTestWaitDuration time.Duration) Option
- func WithClient(c *client.Client) Option
- func WithIngressNamespace(ingressNamespace string) Option
- func WithLogger(logger *zap.Logger) Option
- func WithMetadataRepositoryServiceResourceName(serviceName string) Option
- func WithVarlogNamespace(varlogNamespace string) Option
- type TestCluster
- func (tc *TestCluster) AdminServerAddress(ctx context.Context, t *testing.T) string
- func (tc *TestCluster) ClearMetadataRepositoryNodeData(ctx context.Context, t *testing.T)
- func (tc *TestCluster) ClearStorageNodeData(ctx context.Context, t *testing.T)
- func (tc *TestCluster) GetMetadataRepositoryNodeName(ctx context.Context, t *testing.T, nid types.NodeID) string
- func (tc *TestCluster) GetStorageNodeName(ctx context.Context, t *testing.T, snid types.StorageNodeID) string
- func (tc *TestCluster) ListAdminPods(ctx context.Context, t *testing.T) []core.Pod
- func (tc *TestCluster) ListMetadataRepositoryNodes(ctx context.Context, t *testing.T) []core.Node
- func (tc *TestCluster) ListMetadataRepositoryPods(ctx context.Context, t *testing.T) []core.Pod
- func (tc *TestCluster) ListStorageNodeNodes(ctx context.Context, t *testing.T) []core.Node
- func (tc *TestCluster) ListStorageNodePods(ctx context.Context, t *testing.T) []core.Pod
- func (tc *TestCluster) MetadataRepositoryAddress(ctx context.Context, t *testing.T) string
- func (tc *TestCluster) SetNumMetadataRepositories(ctx context.Context, t *testing.T, desired int32)
- func (tc *TestCluster) Setup(ctx context.Context, t *testing.T)
- func (tc *TestCluster) StartAdminServer(ctx context.Context, t *testing.T)
- func (tc *TestCluster) StartMetadataRepositoryNodes(ctx context.Context, t *testing.T, desired int32)
- func (tc *TestCluster) StartStorageNode(ctx context.Context, t *testing.T, nodeName string) bool
- func (tc *TestCluster) StartStorageNodes(ctx context.Context, t *testing.T, desired int32)
- func (tc *TestCluster) StopAdminServer(ctx context.Context, t *testing.T)
- func (tc *TestCluster) StopMetadataRepositoryNodes(ctx context.Context, t *testing.T)
- func (tc *TestCluster) StopStorageNode(ctx context.Context, t *testing.T, snid types.StorageNodeID) (nodeName string)
- func (tc *TestCluster) StopStorageNodes(ctx context.Context, t *testing.T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func NumStorageNodes ¶
func WithClient ¶
func WithIngressNamespace ¶
func WithLogger ¶
func WithVarlogNamespace ¶
type TestCluster ¶
type TestCluster struct {
// contains filtered or unexported fields
}
TestCluster represents a controller for the cluster on which test suites run.
func NewTestCluster ¶
func NewTestCluster(t *testing.T, opts ...Option) *TestCluster
func (*TestCluster) AdminServerAddress ¶
AdminServerAddress returns the address of the admin server.
func (*TestCluster) ClearMetadataRepositoryNodeData ¶
func (tc *TestCluster) ClearMetadataRepositoryNodeData(ctx context.Context, t *testing.T)
ClearMetadataRepositoryNodeData wipes out data from metadata repositories. This method cleans up all nodes in the node group varlogmr regardless of whether the metadata repositories are running or not.
func (*TestCluster) ClearStorageNodeData ¶
func (tc *TestCluster) ClearStorageNodeData(ctx context.Context, t *testing.T)
ClearStorageNodeData wipes out data from storage nodes. This method cleans up all nodes in the node group varlogsn regardless of whether the storage nodes are running or not.
func (*TestCluster) GetMetadataRepositoryNodeName ¶
func (tc *TestCluster) GetMetadataRepositoryNodeName(ctx context.Context, t *testing.T, nid types.NodeID) string
GetMetadataRepositoryNodeName returns a Kubernetes node name of the repository node specified by the argument nid.
Note that the metadata repository should use the hostNetwork of Kubernetes. To get a node name, this method compares the host IP and container port of the metadata repository pods to the RPC address of the metadata repository.
func (*TestCluster) GetStorageNodeName ¶
func (tc *TestCluster) GetStorageNodeName(ctx context.Context, t *testing.T, snid types.StorageNodeID) string
func (*TestCluster) ListAdminPods ¶
func (*TestCluster) ListMetadataRepositoryNodes ¶
ListMetadataRepositoryNodes returns a list of Kubernetes nodes labeled the node group varlogmr. Note that there can be no running pods in the result nodes.
func (*TestCluster) ListMetadataRepositoryPods ¶
ListMetadataRepositoryPods returns a list of all pods running varlogmr.
func (*TestCluster) ListStorageNodeNodes ¶
ListStorageNodeNodes returns a list of Kubernetes nodes labeled the node group varlogsn. Note that there can be no running pods in the result nodes.
func (*TestCluster) ListStorageNodePods ¶
ListStorageNodePods returns a list of all pods running varlogsn.
func (*TestCluster) MetadataRepositoryAddress ¶
func (*TestCluster) SetNumMetadataRepositories ¶
SetNumMetadataRepositories sets the number of running metadata repositories to the given number. It can either shrink or expand the number of metadata repositories.
func (*TestCluster) Setup ¶
func (tc *TestCluster) Setup(ctx context.Context, t *testing.T)
Setup initializes test cluster.
It stops the admin server, metadata repositories, and storage nodes if they are running yet. It also wipes out data from metadata repositories and storage nodes. To start up the cluster, a metadata repository starts at first. The admin server, then, starts. The remaining metadata repositories start after beginning the admin server. At last, the storage nodes are created.
func (*TestCluster) StartAdminServer ¶
func (tc *TestCluster) StartAdminServer(ctx context.Context, t *testing.T)
StartAdminServer starts the admin server on the node group varlogadm of the cluster.
It sets the number of desired replicas of the varlogadm to one and waits until the pod runs.
func (*TestCluster) StartMetadataRepositoryNodes ¶
func (tc *TestCluster) StartMetadataRepositoryNodes(ctx context.Context, t *testing.T, desired int32)
StartMetadataRepositoryNodes will result in the given number of running metadata repositories on the node group varlogmr of the cluster. If there are already nodes in the cluster more than the given number, this method will fail.
func (*TestCluster) StartStorageNode ¶
func (*TestCluster) StartStorageNodes ¶
StartStorageNodes will result in the given number of running storage nodes on the node group varlogsn of the cluster. If there are already nodes in the cluster more than the given number, this method will fail.
Note that the DaemonSet varlogsn should have a proper nodeAffinity setting since it sets the node label `varlogsn-status` of the node group varlogsn to `started`.
func (*TestCluster) StopAdminServer ¶
func (tc *TestCluster) StopAdminServer(ctx context.Context, t *testing.T)
StopAdminServer stops the admin server.
It sets the number of desired replicas of the varlogadm to zero and waits until the pod stops.
func (*TestCluster) StopMetadataRepositoryNodes ¶
func (tc *TestCluster) StopMetadataRepositoryNodes(ctx context.Context, t *testing.T)
StopMetadataRepositoryNodes stops all metadata repositories.
func (*TestCluster) StopStorageNode ¶
func (tc *TestCluster) StopStorageNode(ctx context.Context, t *testing.T, snid types.StorageNodeID) (nodeName string)
StopStorageNode stops the storage node specified by the argument snid and returns the Kubernetes node name that had run the storage node.
func (*TestCluster) StopStorageNodes ¶
func (tc *TestCluster) StopStorageNodes(ctx context.Context, t *testing.T)
StopStorageNodes stops all storage nodes. It changes the node label DefaultNodeStatusLabelStorageNode from DefaultNodeStatusStarted to DefaultNodeStatusStopped.