Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions mantle/cmd/kolet/kolet.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ func initiateReboot(mark string) error {
return nil
}

func mkfifo(path string) error {
c := exec.Command("mkfifo", path)
c.Stderr = os.Stderr
err := c.Run()
if err != nil {
return fmt.Errorf("creating fifo %s: %w", path, err)
}
return nil
}

func runExtUnit(cmd *cobra.Command, args []string) error {
rebootOff, _ := cmd.Flags().GetBool("deny-reboots")
// Write the autopkgtest wrappers
Expand All @@ -276,7 +286,7 @@ func runExtUnit(cmd *cobra.Command, args []string) error {

// We want to prevent certain tests (like non-exclusive tests) from rebooting
if !rebootOff {
err := exec.Command("mkfifo", rebootRequestFifo).Run()
err := mkfifo(rebootRequestFifo)
if err != nil {
return err
}
Expand Down Expand Up @@ -366,7 +376,7 @@ func runReboot(cmd *cobra.Command, args []string) error {

mark := args[0]
systemdjournal.Print(systemdjournal.PriInfo, "Requesting reboot with mark: %s", mark)
err := exec.Command("mkfifo", kola.KoletRebootAckFifo).Run()
err := mkfifo(kola.KoletRebootAckFifo)
if err != nil {
return err
}
Expand Down
7 changes: 3 additions & 4 deletions mantle/kola/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,6 @@ func metadataFromTestBinary(executable string) (*externalTestMeta, error) {
// handling.
func runExternalTest(c cluster.TestCluster, mach platform.Machine, testNum int) error {
var previousRebootState string
var stdout []byte
for {
bootID, err := platform.GetMachineBootId(mach)
if err != nil {
Expand All @@ -1126,11 +1125,11 @@ func runExternalTest(c cluster.TestCluster, mach platform.Machine, testNum int)
unit := fmt.Sprintf("%s.service", KoletExtTestUnit)
cmd = fmt.Sprintf("sudo /usr/local/bin/kolet run-test-unit %s", shellquote.Join(unit))
}
stdout, err = c.SSH(mach, cmd)

stdout, stderr, err := mach.SSH(cmd)
if err != nil {
return errors.Wrapf(err, "kolet run-test-unit failed")
return errors.Wrapf(err, "kolet run-test-unit failed: %s %s", string(stdout), string(stderr))
}

koletRes := KoletResult{}
if len(stdout) > 0 {
err = json.Unmarshal(stdout, &koletRes)
Expand Down
1 change: 1 addition & 0 deletions mantle/platform/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func (bc *BaseCluster) SSH(m Machine, cmd string) ([]byte, []byte, error) {
session.Stdout = &stdout
session.Stderr = &stderr
err = session.Run(cmd)
plog.Debugf("Running cmd=%v res=%v", cmd, err)
outBytes := bytes.TrimSpace(stdout.Bytes())
errBytes := bytes.TrimSpace(stderr.Bytes())
return outBytes, errBytes, err
Expand Down
Loading