-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VBoxManage is missing from CI #14
Comments
It seems this project never had a success build from very beginning. It requires to mock the output |
#15 Adds the ability to override the executor, meaning we can mock the output, but that still needs to be done. Right now it works like volkswagen and all tests just pass. I would rather not have each test add to a massive list of elements to the func mockOutput(out string) {
defaultExecutor = func(ctx context.Context, so io.Writer, se io.Writer, args ...string) error {
fmt.Fprint(so, out)
return nil
}
} func TestListMachines(t *testing.T) {
testCases := map[string]struct{
out string
want []*Machine
wantErr error
}{
"empty": {
"",
[]*Machine{},
nil
},
"single: {
"\"Test\" {1b2de526-b913-482a-b8aa-dfef87bbb840}",
[]*Machine{&Machine{Name: "Test", UUID: "1b2de526-b913-482a-b8aa-dfef87bbb840"},
nil,
},
"error": {
"VBoxManage: error: Unknown option: --status",
[]*Machine{},
ErrUnknownOption,
},
}
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
mockOutput(tc.out)
ms, err := ListMachines()
if errors.Is(err, tc.wantErr) {
t.Errorf("ListMachines() err = %v, want %v", err, tc.wantErr)
}
if diff := deep.Equal(ms, tc.want) {
t.Errorf("ListMachines() = %v, want %v, diff: %v", err, tc.want, diff)
}
})
}
} |
#17 fixed this with a full mock setup. |
This affects #13 and #11 from what I can see and is blocking the merge of the PRs.
The text was updated successfully, but these errors were encountered: