mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-12 12:36:55 +00:00
e2e: Cover RunnerDeployment (#668)
Previously the E2E test suite covered only RunnerSet. This refactors the existing E2E test code to extract the common test structure into a `env` struct and its methods, and use it to write two very similar tests, one for RunnerSet and another for RunnerDeployment.
This commit is contained in:
31
testing/runtime/runtime.go
Normal file
31
testing/runtime/runtime.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Cmdr struct {
|
||||
}
|
||||
|
||||
func (k Cmdr) CombinedOutput(cmd *exec.Cmd) (string, error) {
|
||||
o, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
args := append([]string{}, cmd.Args...)
|
||||
args[0] = cmd.Path
|
||||
|
||||
cs := strings.Join(args, " ")
|
||||
s := string(o)
|
||||
k.Errorf("%s failed with output:\n%s", cs, s)
|
||||
|
||||
return s, err
|
||||
}
|
||||
|
||||
return string(o), nil
|
||||
}
|
||||
|
||||
func (k Cmdr) Errorf(f string, args ...interface{}) {
|
||||
fmt.Fprintf(os.Stderr, f+"\n", args...)
|
||||
}
|
||||
Reference in New Issue
Block a user