package remote
import "k8s.io/kubernetes/test/e2e_node/remote"
Package remote contains implementations of the TestSuite interface, which specify how to run various node test suites remotely.
Index ¶
- func AddHostnameIP(hostname, ip string)
- func AddSSHKey(hostname, keyFilePath string)
- func CreateTestArchive(suite TestSuite, systemSpecName, kubeletConfigFile string) (string, error)
- func GetHostnameOrIP(hostname string) string
- func GetSSHUser() string
- func GetTestSuiteKeys() []string
- func GetTimestampFromWorkspaceDir(dir string) string
- func RegisterTestSuite(name string, suite TestSuite)
- func RunRemote(cfg RunRemoteConfig) (string, bool, error)
- func RunRemoteTestSuite(testSuite TestSuite)
- func SSH(host string, cmd ...string) (string, error)
- func SSHNoSudo(host string, cmd ...string) (string, error)
- func WriteLog(host, filename, content string) error
- type Accelerator
- type Archive
- type CAdvisorE2ERemote
- func (n *CAdvisorE2ERemote) RunTest(host, workspace, _, _, _, _, _, _, _, _ string, timeout time.Duration) (string, error)
- func (n *CAdvisorE2ERemote) SetupTestPackage(tardir, systemSpecName string) error
- type Config
- type ConformanceRemote
- func (c *ConformanceRemote) RunTest(host, workspace, results, imageDesc, junitFilePrefix, testArgs, _, systemSpecName, extraEnvs, _ string, timeout time.Duration) (string, error)
- func (c *ConformanceRemote) SetupTestPackage(tardir, systemSpecName string) error
- type GCEImage
- type GCEImageConfig
- type GCERunner
- func NewGCERunner(cfg Config) *GCERunner
- func (g *GCERunner) StartTests(suite TestSuite, archivePath string, results chan *TestResult) (numTests int)
- func (g *GCERunner) Validate() error
- type NodeE2ERemote
- func (n *NodeE2ERemote) RunTest(host, workspace, results, imageDesc, junitFilePrefix, testArgs, ginkgoArgs, systemSpecName, extraEnvs, runtimeConfig string, timeout time.Duration) (string, error)
- func (n *NodeE2ERemote) SetupTestPackage(tardir, systemSpecName string) error
- type Resources
- type RunRemoteConfig
- type Runner
- type SSHRunner
- func (s *SSHRunner) StartTests(suite TestSuite, archivePath string, results chan *TestResult) (numTests int)
- func (s *SSHRunner) Validate() error
- type TestResult
- type TestSuite
Functions ¶
func AddHostnameIP ¶
func AddHostnameIP(hostname, ip string)
AddHostnameIP adds <hostname,ip> pair into hostnameIPOverrides map.
func AddSSHKey ¶
func AddSSHKey(hostname, keyFilePath string)
AddSSHKey adds a <hosrtname,path to SSH private key> pair into the sshKeyOverrides map
func CreateTestArchive ¶
CreateTestArchive creates the archive package for the node e2e test.
func GetHostnameOrIP ¶
GetHostnameOrIP converts hostname into ip and apply user if necessary.
func GetSSHUser ¶
func GetSSHUser() string
GetSSHUser returns the ssh-user CLI flag, the KUBE_SSH_USER environment variable, or the default ssh user for the ssh environment in that order
func GetTestSuiteKeys ¶
func GetTestSuiteKeys() []string
func GetTimestampFromWorkspaceDir ¶
GetTimestampFromWorkspaceDir parses the workspace directory name and gets the timestamp part of it. This can later be used to name other artifacts (such as the kubelet-${instance}.service systemd transient service used to launch Kubelet) so that they can be matched to each other.
func RegisterTestSuite ¶
func RunRemote ¶
func RunRemote(cfg RunRemoteConfig) (string, bool, error)
func RunRemoteTestSuite ¶
func RunRemoteTestSuite(testSuite TestSuite)
func SSH ¶
SSH executes ssh command with runSSHCommand as root. The `sudo` makes sure that all commands are executed by root, so that there won't be permission mismatch between different commands.
func SSHNoSudo ¶
SSHNoSudo executes ssh command with runSSHCommand as normal user. Sometimes we need this, for example creating a directory that we'll copy files there with scp.
func WriteLog ¶
WriteLog is a temporary function to make it possible to write log in the runner. This is used to collect serial console log. TODO(random-liu): Use the log-dump script in cluster e2e.
Types ¶
type Accelerator ¶
type Accelerator struct { Type string `json:"type,omitempty"` Count int64 `json:"count,omitempty"` }
Accelerator contains type and count about resource.
type Archive ¶
Archive contains path info in the archive.
type CAdvisorE2ERemote ¶
type CAdvisorE2ERemote struct{}
CAdvisorE2ERemote contains the specific functions in the cadvisor e2e test suite.
func (*CAdvisorE2ERemote) RunTest ¶
func (n *CAdvisorE2ERemote) RunTest(host, workspace, _, _, _, _, _, _, _, _ string, timeout time.Duration) (string, error)
RunTest implements TestSuite.RunTest
func (*CAdvisorE2ERemote) SetupTestPackage ¶
func (n *CAdvisorE2ERemote) SetupTestPackage(tardir, systemSpecName string) error
SetupTestPackage implements TestSuite.SetupTestPackage
type Config ¶
type Config struct { InstanceNamePrefix string ImageConfigFile string Images []string ImageConfigDir string GinkgoFlags string DeleteInstances bool Cleanup bool TestArgs string ExtraEnvs string RuntimeConfig string SystemSpecName string Hosts []string }
type ConformanceRemote ¶
type ConformanceRemote struct{}
ConformanceRemote contains the specific functions in the node conformance test suite.
func (*ConformanceRemote) RunTest ¶
func (c *ConformanceRemote) RunTest(host, workspace, results, imageDesc, junitFilePrefix, testArgs, _, systemSpecName, extraEnvs, _ string, timeout time.Duration) (string, error)
RunTest runs test on the node.
func (*ConformanceRemote) SetupTestPackage ¶
func (c *ConformanceRemote) SetupTestPackage(tardir, systemSpecName string) error
SetupTestPackage sets up the test package with binaries k8s required for node conformance test
type GCEImage ¶
type GCEImage struct { Image string `json:"image,omitempty"` ImageRegex string `json:"image_regex,omitempty"` // ImageFamily is the image family to use. The latest image from the image family will be used, e.g cos-81-lts. ImageFamily string `json:"image_family,omitempty"` ImageDesc string `json:"image_description,omitempty"` KernelArguments []string `json:"kernel_arguments,omitempty"` Project string `json:"project"` Metadata string `json:"metadata"` Machine string `json:"machine,omitempty"` Resources Resources `json:"resources,omitempty"` }
GCEImage contains some information about GCE Image.
type GCEImageConfig ¶
GCEImageConfig specifies what images should be run and how for these tests. It can be created via the `--images` and `--image-project` flags, or by specifying the `--image-config-file` flag, pointing to a json or yaml file of the form:
images: short-name: image: gce-image-name project: gce-image-project machine: for benchmark only, the machine type (GCE instance) to run test tests: for benchmark only, a list of ginkgo focus strings to match tests
TODO(coufon): replace 'image' with 'node' in configurations and we plan to support testing custom machines other than GCE by specifying Host
type GCERunner ¶
type GCERunner struct {
// contains filtered or unexported fields
}
func NewGCERunner ¶
func (*GCERunner) StartTests ¶
func (g *GCERunner) StartTests(suite TestSuite, archivePath string, results chan *TestResult) (numTests int)
func (*GCERunner) Validate ¶
type NodeE2ERemote ¶
type NodeE2ERemote struct{}
NodeE2ERemote contains the specific functions in the node e2e test suite.
func (*NodeE2ERemote) RunTest ¶
func (n *NodeE2ERemote) RunTest(host, workspace, results, imageDesc, junitFilePrefix, testArgs, ginkgoArgs, systemSpecName, extraEnvs, runtimeConfig string, timeout time.Duration) (string, error)
RunTest runs test on the node.
func (*NodeE2ERemote) SetupTestPackage ¶
func (n *NodeE2ERemote) SetupTestPackage(tardir, systemSpecName string) error
SetupTestPackage sets up the test package with binaries k8s required for node e2e tests
type Resources ¶
type Resources struct { Accelerators []Accelerator `json:"accelerators,omitempty"` }
Resources contains accelerators array.
type RunRemoteConfig ¶
type RunRemoteConfig struct {
// contains filtered or unexported fields
}
RunRemote returns the command Output, whether the exit was ok, and any errors
type Runner ¶
type Runner interface { Validate() error StartTests(suite TestSuite, archivePath string, results chan *TestResult) (numTests int) }
func NewSSHRunner ¶
type SSHRunner ¶
type SSHRunner struct {
// contains filtered or unexported fields
}
func (*SSHRunner) StartTests ¶
func (s *SSHRunner) StartTests(suite TestSuite, archivePath string, results chan *TestResult) (numTests int)
func (*SSHRunner) Validate ¶
type TestResult ¶
TestResult contains some information about the test results.
type TestSuite ¶
type TestSuite interface { // SetupTestPackage setup the test package in the given directory. TestSuite // should put all necessary binaries and dependencies into the path. The caller // will: // * create a tarball with the directory. // * deploy the tarball to the testing host. // * untar the tarball to the testing workspace on the testing host. SetupTestPackage(path, systemSpecName string) error // RunTest runs test on the node in the given workspace and returns test output // and test error if there is any. // * host is the target node to run the test. // * workspace is the directory on the testing host the test is running in. Note // that the test package is unpacked in the workspace before running the test. // * results is the directory the test should write result into. All logs should be // saved as *.log, all junit file should start with junit*. // * imageDesc is the description of the image the test is running on. // It will be used for logging purpose only. // * junitFilePrefix is the prefix of output junit file. // * testArgs is the arguments passed to test. // * ginkgoArgs is the arguments passed to ginkgo. // * systemSpecName is the name of the system spec used for validating the // image on which the test runs. // * extraEnvs is the extra environment variables needed for node e2e tests. // * runtimeConfig is the API runtime configuration used for node e2e tests. // * timeout is the test timeout. RunTest(host, workspace, results, imageDesc, junitFilePrefix, testArgs, ginkgoArgs, systemSpecName, extraEnvs, runtimeConfig string, timeout time.Duration) (string, error) }
TestSuite is the interface of a test suite, such as node e2e, node conformance, node soaking, cri validation etc.
func GetTestSuite ¶
Source Files ¶
cadvisor_e2e.go gce_runner.go node_conformance.go node_e2e.go remote.go run_remote_suite.go runner.go ssh.go ssh_runner.go types.go utils.go
- Version
- v1.27.14
- Published
- May 14, 2024
- Platform
- js/wasm
- Imports
- 32 packages
- Last checked
- 6 minutes ago –
Tools for package owners.