talos/internal/integration/cli/etcd.go
Artem Chernyshev a83e8758db feat: add commands to manage/query etcd cluster
Used already existing protobufs for that.

Commands:
`talosctl etcd members -n <node>`
`talosctl etcd leave -n <node>`
`talosctl etcd forfeit-leadership -n <node>`

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
2020-12-22 11:49:10 -08:00

39 lines
1.1 KiB
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// +build integration_cli
package cli
import (
"github.com/talos-systems/talos/internal/integration/base"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
)
// EtcdSuite verifies etcd command.
type EtcdSuite struct {
base.CLISuite
}
// SuiteName ...
func (suite *EtcdSuite) SuiteName() string {
return "cli.EtcdSuite"
}
// TestMembers etcd members should have some output.
func (suite *EtcdSuite) TestMembers() {
suite.RunCLI([]string{"etcd", "members", "--nodes", suite.RandomDiscoveredNode(machine.TypeControlPlane)}) // default checks for stdout not empty
}
// TestForfeitLeadership etcd forfeit-leadership check.
func (suite *EtcdSuite) TestForfeitLeadership() {
suite.RunCLI([]string{"etcd", "forfeit-leadership", "--nodes", suite.RandomDiscoveredNode(machine.TypeControlPlane)},
base.StdoutEmpty(),
)
}
func init() {
allSuites = append(allSuites, new(EtcdSuite))
}