-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parallels: fix and simplify Prlctl/Prlsrvctl handling (#284)
* Simplify Prlctl/Prlsrvctl error handling * Don't try to find Parallels messages in non-exec.ExitError errors * runParallelsCommand: fix logic
- Loading branch information
Showing
5 changed files
with
75 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
internal/executor/instance/persistentworker/isolation/parallels/cli_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package parallels_test | ||
|
||
import ( | ||
"context" | ||
"github.com/cirruslabs/cirrus-cli/internal/executor/instance/persistentworker/isolation/parallels" | ||
"github.com/stretchr/testify/assert" | ||
"os" | ||
"testing" | ||
) | ||
|
||
func TestPrlctl(t *testing.T) { | ||
ctx := context.Background() | ||
|
||
_, imageOk := os.LookupEnv("CIRRUS_INTERNAL_PARALLELS_VM") | ||
_, userOk := os.LookupEnv("CIRRUS_INTERNAL_PARALLELS_SSH_USER") | ||
_, passwordOk := os.LookupEnv("CIRRUS_INTERNAL_PARALLELS_SSH_PASSWORD") | ||
if !imageOk || !userOk || !passwordOk { | ||
t.SkipNow() | ||
} | ||
|
||
// Working example | ||
_, _, err := parallels.Prlctl(ctx, "list") | ||
assert.NoError(t, err) | ||
|
||
// Non-working example | ||
expectedErrorMessage := `Parallels command returned non-zero exit code: "Failed to get VM config: The virtual` + | ||
` machine could not be found. The virtual machine is not registered in the virtual machine directory on your Mac."` | ||
|
||
_, _, err = parallels.Prlctl(ctx, "list", "non-existent-vm") | ||
assert.Error(t, err) | ||
assert.Equal(t, expectedErrorMessage, err.Error()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters