Apply suggestions from code review
parent
e28a1b411b
commit
ee22b47795
|
@ -585,7 +585,7 @@ func deleteMachineDirectories(cc *config.ClusterConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// killMountProcess looks for the legacy path and for profile path for a pidfile,
|
// killMountProcess looks for the legacy path and for profile path for a pidfile,
|
||||||
// it then tries to kill all the pids listed in the pidfile(one or more)
|
// it then tries to kill all the pids listed in the pidfile (one or more)
|
||||||
func killMountProcess() error {
|
func killMountProcess() error {
|
||||||
profile := viper.GetString("profile")
|
profile := viper.GetString("profile")
|
||||||
paths := []string{
|
paths := []string{
|
||||||
|
@ -602,7 +602,7 @@ func killMountProcess() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// killProcess takes a path to look for a pidfile(space-separated),
|
// killProcess takes a path to look for a pidfile (space-separated),
|
||||||
// it reads the file and converts it to a bunch of pid ints,
|
// it reads the file and converts it to a bunch of pid ints,
|
||||||
// then it tries to kill each one of them.
|
// then it tries to kill each one of them.
|
||||||
// If no errors were ecnountered, it cleans the pidfile
|
// If no errors were ecnountered, it cleans the pidfile
|
||||||
|
@ -634,14 +634,14 @@ func killProcess(path string) error {
|
||||||
} else if len(errs) != 0 {
|
} else if len(errs) != 0 {
|
||||||
// if multiple errors were encountered, we're outputting them
|
// if multiple errors were encountered, we're outputting them
|
||||||
// and returning a new multiple-errors error:
|
// and returning a new multiple-errors error:
|
||||||
out.Step(style.Failure, "Ecountered multiple errors:")
|
out.Styled(style.Failure, "Multiple errors encountered:")
|
||||||
for _, e := range errs {
|
for _, e := range errs {
|
||||||
out.Err("%v\n", e)
|
out.Err("%v\n", e)
|
||||||
}
|
}
|
||||||
return errors.New("multiple errors encountered while closing mount processes")
|
return errors.New("multiple errors encountered while closing mount processes")
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no errors were encoutered, it is safe to clean out the pidFile
|
// if no errors were encoutered, it's safe to delete pidFile
|
||||||
if err := os.Remove(pidPath); err != nil {
|
if err := os.Remove(pidPath); err != nil {
|
||||||
return errors.Wrap(err, "While closing mount-pids file")
|
return errors.Wrap(err, "While closing mount-pids file")
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,7 +327,7 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) { // no
|
||||||
// if something weird has happened from previous tests..
|
// if something weird has happened from previous tests..
|
||||||
// this could at least spare us some waiting
|
// this could at least spare us some waiting
|
||||||
if strings.Contains(rr.Stdout.String(), fmt.Sprintf("Profile \"%s\" not found.", profile)) {
|
if strings.Contains(rr.Stdout.String(), fmt.Sprintf("Profile \"%s\" not found.", profile)) {
|
||||||
t.Fatalf("somehow the profile got cancelled; failing....")
|
t.Fatalf("profile was deleted, cancelling the test")
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ func validateMountCmd(ctx context.Context, t *testing.T, profile string) { // no
|
||||||
for _, mntp := range mntProcs {
|
for _, mntp := range mntProcs {
|
||||||
// Trying to wait for process end
|
// Trying to wait for process end
|
||||||
// if the wait fail with ExitError we know that the process
|
// if the wait fail with ExitError we know that the process
|
||||||
// doesnt' exist anymore..
|
// doesn't exist anymore..
|
||||||
go func(end chan bool) {
|
go func(end chan bool) {
|
||||||
err := mntp.cmd.Wait()
|
err := mntp.cmd.Wait()
|
||||||
if _, ok := err.(*exec.ExitError); ok {
|
if _, ok := err.(*exec.ExitError); ok {
|
||||||
|
|
Loading…
Reference in New Issue