talos/internal/integration/base/cluster.go
Andrey Smirnov 773912833e test: clean up integration test code, fix flakes
This enables golangci-lint via build tags for integration tests (this
should have been done long ago!), and fixes the linting errors.

Two tests were updated to reduce flakiness:

* apply config: wait for nodes to issue "boot done" sequence event
before proceeding
* recover: kill pods even if they appear after the initial set gets
killed (potential race condition with previous test).

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-10-19 15:44:14 -07:00

34 lines
895 B
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
package base
import "github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
type infoWrapper struct {
masterNodes []string
workerNodes []string
}
func (wrapper *infoWrapper) Nodes() []string {
return append([]string(nil), append(wrapper.masterNodes, wrapper.workerNodes...)...)
}
func (wrapper *infoWrapper) NodesByType(t machine.Type) []string {
switch t {
case machine.TypeInit:
return nil
case machine.TypeControlPlane:
return append([]string(nil), wrapper.masterNodes...)
case machine.TypeJoin:
return append([]string(nil), wrapper.workerNodes...)
case machine.TypeUnknown:
fallthrough
default:
panic("unreachable")
}
}