Open rohanKanojia opened 3 weeks ago
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign cfergeau for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
Hi @rohanKanojia. Thanks for your PR.
I'm waiting for a crc-org member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test
on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test
label.
I understand the commands that are listed here.
Description
Fixes: Issue #4407
Relates to: Issue #4407, PR https://github.com/crc-org/crc/pull/4400
Type of change
Checklist
Solution/Idea
machine
package client use the VirtualMachine interface instead of a concrete implementation. This way we can inject a dummy test FakeVirtualMachine implementation into client tests that can ease writing tests for this package.Bundle()
Driver()
API()
GetHost()
VirtualMachine
in the client so we can avoid creating it if it's already created.newClientWithVirtualMachine
in machine client that would have an additional VirtualMachine argument, this would be kept package private so that it's used only by tests in the same package.fakemachine
for adding dummy implementation forVirtualMachine
interface. Currently, I've only completed methods used bystop_test.go
, I'll add more in small increments as I get more familiar with the project.Proposed changes
VirtualMachine
interface and make client member functions use it instead ofvirtualMachine
struct.VirtualMachine
implementation from testsVirtualMachine
interface instead ofvirtualMachine
struct (these changes are only related to changing use ofvirtualMachine
struct toVirtualMachine
interface:pkg/crc/machine/ip.go
pkg/crc/machine/poweroff.go
pkg/crc/machine/start.go
pkg/crc/machine/status.go
pkg/crc/machine/stop.go
Testing
It's a small refactor. I've only run E2E tests locally to verify if these changes don't introduce any kind of regression.