Remove sudo in test suite and run test with sudo.

This commit is contained in:
Random-Liu
2016-08-18 21:50:33 -07:00
parent 13a50e3b97
commit 919935beec
8 changed files with 65 additions and 70 deletions

View File

@@ -172,12 +172,11 @@ func validateSystem() error {
if err != nil {
return fmt.Errorf("can't get current binary: %v", err)
}
// TODO(random-liu): Remove sudo in containerize PR.
output, err := exec.Command("sudo", testBin, "--system-validate-mode").CombinedOutput()
output, err := exec.Command(testBin, append([]string{"--system-validate-mode"}, os.Args[1:]...)...).CombinedOutput()
// The output of system validation should have been formatted, directly print here.
fmt.Print(string(output))
if err != nil {
return fmt.Errorf("system validation failed")
return fmt.Errorf("system validation failed: %v", err)
}
return nil
}
@@ -190,7 +189,7 @@ func maskLocksmithdOnCoreos() {
return
}
if bytes.Contains(data, []byte("ID=coreos")) {
output, err := exec.Command("sudo", "systemctl", "mask", "--now", "locksmithd").CombinedOutput()
output, err := exec.Command("systemctl", "mask", "--now", "locksmithd").CombinedOutput()
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("should be able to mask locksmithd - output: %q", string(output)))
glog.Infof("Locksmithd is masked successfully")
}