mirror of
				https://github.com/siderolabs/talos.git
				synced 2025-10-31 00:11:36 +01:00 
			
		
		
		
	Fixes #6676 There was a mix of stdout/stderr, move more consistently to stderr. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
		
			
				
	
	
		
			70 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			1.5 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/.
 | |
| 
 | |
| //go:build integration_cli
 | |
| 
 | |
| package cli
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 	"os"
 | |
| 
 | |
| 	"github.com/siderolabs/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"
 | |
| }
 | |
| 
 | |
| // SetupTest ...
 | |
| func (suite *ValidateSuite) SetupTest() {
 | |
| 	suite.tmpDir = suite.T().TempDir()
 | |
| 
 | |
| 	var err error
 | |
| 	suite.savedCwd, err = os.Getwd()
 | |
| 	suite.Require().NoError(err)
 | |
| 
 | |
| 	suite.Require().NoError(os.Chdir(suite.tmpDir))
 | |
| }
 | |
| 
 | |
| // TearDownTest ...
 | |
| func (suite *ValidateSuite) TearDownTest() {
 | |
| 	if suite.savedCwd != "" {
 | |
| 		suite.Require().NoError(os.Chdir(suite.savedCwd))
 | |
| 	}
 | |
| }
 | |
| 
 | |
| // TestValidate generates config and validates it for all the modes.
 | |
| func (suite *ValidateSuite) TestValidate() {
 | |
| 	suite.RunCLI([]string{"gen", "config", "foobar", "https://10.0.0.1"},
 | |
| 		base.StdoutEmpty(),
 | |
| 		base.StderrNotEmpty(),
 | |
| 	)
 | |
| 
 | |
| 	for _, configFile := range []string{"controlplane.yaml", "worker.yaml"} {
 | |
| 		configFile := configFile
 | |
| 
 | |
| 		for _, mode := range []string{"cloud", "container"} {
 | |
| 			mode := mode
 | |
| 
 | |
| 			suite.Run(fmt.Sprintf("%s-%s", configFile, mode), func() {
 | |
| 				suite.RunCLI([]string{"validate", "-m", mode, "-c", configFile, "--strict"})
 | |
| 			})
 | |
| 		}
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func init() {
 | |
| 	allSuites = append(allSuites, new(ValidateSuite))
 | |
| }
 |