Skip to content

Commit

Permalink
evetestkit : new utils
Browse files Browse the repository at this point in the history
- allow for delplying pre-conifged vms like Ubuntu
- allow for vm reuse of test is not destructive
- allow for copying multitude of test scripts at once

Signed-off-by: Shahriyar Jalayeri <[email protected]>
  • Loading branch information
shjala committed Oct 23, 2024
1 parent c38f259 commit 8a05029
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions pkg/evetestkit/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ type EveNode struct {
ip string
t *testing.T
ts []TestScript
ts []TestScript
}

// AppOption is a function that sets the configuration for the app running on
Expand All @@ -112,7 +111,7 @@ type AppOption func(n *EveNode, appName string)
// TestOption is a function that sets the configuration for the test
type TestOption func()

func dumpToTpm(name, content string) (string, error) {
func dumpToTemp(name, content string) (string, error) {
path := path.Join("/tmp/", name)
err := os.WriteFile(path, []byte(content), 0644)
if err != nil {
Expand Down Expand Up @@ -168,15 +167,6 @@ func (node *EveNode) GetAppNames() []string {
return names
}

// GetAppNames returns the names of the apps running on the EVE node
func (node *EveNode) GetAppNames() []string {
names := make([]string, len(node.apps))
for i, app := range node.apps {
names[i] = app.name
}
return names
}

// EveRunCommand runs a command on the EVE node
func (node *EveNode) EveRunCommand(command string) ([]byte, error) {
realStdout := os.Stdout
Expand Down Expand Up @@ -344,11 +334,9 @@ func (node *EveNode) AppSSHExec(appName, command string) (string, error) {
return "", fmt.Errorf("app %s not found, make sure to deploy app/vm with WithSSH option", appName)
}

host := fmt.Sprintf("%s:%s", node.ip, appConfig.internal.sshPort)
host := fmt.Sprintf("%s:%s", node.ip, appConfig.internal.sshPort)

config := &ssh.ClientConfig{
User: appConfig.internal.sshUser,
User: appConfig.internal.sshUser,
Auth: []ssh.AuthMethod{
ssh.Password(appConfig.internal.sshPass),
Expand Down

0 comments on commit 8a05029

Please sign in to comment.