talos/internal/integration/base/base.go
Andrey Smirnov ebd40bd0eb chore: use osctl cluster --wait in basic-integration
There are few workarounds for Drone way of running integration test:
DinD runs as a separate pod, and we can only access its exposed on the
"host" ports, while from Talos cluster this endpoint is not reachable.

So internally Talos nodes still use addresses like "10.5.0.2", while
test is using "docker" to access it (that's name of the `docker` service
in the pipeline).

When running locally, 127.0.0.1 is used as endpoint, which should work
fine both on OS X and Linux.

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2019-12-30 15:15:42 -08:00

55 lines
1.6 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
// Package base provides shared definition of base suites for tests
package base
// TalosSuite defines most common settings for integration test suites
type TalosSuite struct {
// Endpoint to use to connect, if not set config is used
Endpoint string
// K8sEndpoint is API server endpoint, if set overrides kubeconfig
K8sEndpoint string
// Nodes is a list of Talos cluster addresses (overrides discovery if set)
Nodes []string
// TalosConfig is a path to talosconfig
TalosConfig string
// Version is the (expected) version of Talos tests are running against
Version string
// OsctlPath is path to osctl binary
OsctlPath string
discoveredNodes []string
}
// DiscoverNodes provides basic functionality to discover cluster nodes via test settings.
//
// This method is overridden in specific suites to allow for specific discovery.
func (talosSuite *TalosSuite) DiscoverNodes() []string {
if talosSuite.discoveredNodes == nil {
if talosSuite.Nodes != nil {
talosSuite.discoveredNodes = talosSuite.Nodes
}
}
return talosSuite.discoveredNodes
}
// ConfiguredSuite expects config to be set before running
type ConfiguredSuite interface {
SetConfig(config TalosSuite)
}
// SetConfig implements ConfiguredSuite
func (suite *TalosSuite) SetConfig(config TalosSuite) {
*suite = config
}
// NamedSuite interface provides names for test suites
type NamedSuite interface {
SuiteName() string
}