talos/internal/integration/cli/validate.go
Andrew Rynhard 49307d554d refactor: improve machined
This is a rewrite of machined. It addresses some of the limitations and
complexity in the implementation. This introduces the idea of a
controller. A controller is responsible for managing the runtime, the
sequencer, and a new state type introduced in this PR.

A few highlights are:

- no more event bus
- functional approach to tasks (no more types defined for each task)
  - the task function definition now offers a lot more context, like
    access to raw API requests, the current sequence, a logger, the new
    state interface, and the runtime interface.
- no more panics to handle reboots
- additional initialize and reboot sequences
- graceful gRPC server shutdown on critical errors
- config is now stored at install time to avoid having to download it at
  install time and at boot time
- upgrades now use the local config instead of downloading it
- the upgrade API's preserve option takes precedence over the config's
  install force option

Additionally, this pulls various packes in under machined to make the
code easier to navigate.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-04-28 08:20:55 -07:00

59 lines
1.4 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 (
"io/ioutil"
"os"
"github.com/talos-systems/talos/internal/integration/base"
)
// ValidateSuite verifies dmesg command
type ValidateSuite struct {
base.CLISuite
tmpDir string
savedCwd string
}
// SuiteName ...
func (suite *ValidateSuite) SuiteName() string {
return "cli.ValidateSuite"
}
func (suite *ValidateSuite) SetupTest() {
var err error
suite.tmpDir, err = ioutil.TempDir("", "talos")
suite.Require().NoError(err)
suite.savedCwd, err = os.Getwd()
suite.Require().NoError(err)
suite.Require().NoError(os.Chdir(suite.tmpDir))
}
func (suite *ValidateSuite) TearDownTest() {
suite.Require().NoError(os.Chdir(suite.savedCwd))
suite.Require().NoError(os.RemoveAll(suite.tmpDir))
}
// TestValidate generates config and validates it for all the modes.
func (suite *ValidateSuite) TestValidate() {
suite.RunOsctl([]string{"gen", "config", "foobar", "https://10.0.0.1"})
for _, configFile := range []string{"init.yaml", "controlplane.yaml", "join.yaml"} {
for _, mode := range []string{"cloud", "container", "metal"} {
suite.RunOsctl([]string{"validate", "-m", mode, "-c", configFile})
}
}
}
func init() {
allSuites = append(allSuites, new(ValidateSuite))
}