Repository: code-ready/crc
Pull request #2173 (2021-03-31 13:06:38)

Fix compilation errors after 2 merges

openshift-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/code-ready/crc/pull/2173#" title="Author self-approved">guillaumerose</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=code-ready%2Fcrc).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/code-ready/crc/blob/master/OWNERS)~~ [guillaumerose]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
openshift-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/code-ready/crc/pull/2173#pullrequestreview-625266988" title="Approved">cfergeau</a>*, *<a href="https://github.com/code-ready/crc/pull/2173#" title="Author self-approved">guillaumerose</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=code-ready%2Fcrc).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/code-ready/crc/blob/master/OWNERS)~~ [cfergeau,guillaumerose]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/pkg/crc/machine/sync.go b/pkg/crc/machine/sync.go
index 8c9ebb0ca..5099e5781 100644
--- a/pkg/crc/machine/sync.go
+++ b/pkg/crc/machine/sync.go
@@ -7,6 +7,7 @@ import (
 	"time"
 
 	"github.com/code-ready/crc/pkg/crc/logging"
+	"github.com/code-ready/crc/pkg/crc/machine/types"
 	"github.com/code-ready/machine/libmachine/state"
 )
 
@@ -82,7 +83,7 @@ func (s *Synchronized) prepareStart(startCancel context.CancelFunc) error {
 	return nil
 }
 
-func (s *Synchronized) Start(ctx context.Context, startConfig StartConfig) (*StartResult, error) {
+func (s *Synchronized) Start(ctx context.Context, startConfig types.StartConfig) (*types.StartResult, error) {
 	ctx, startCancel := context.WithCancel(ctx)
 	if err := s.prepareStart(startCancel); err != nil {
 		return nil, err
@@ -149,7 +150,7 @@ func (s *Synchronized) Exists() (bool, error) {
 	return s.underlying.Exists()
 }
 
-func (s *Synchronized) GetConsoleURL() (*ConsoleResult, error) {
+func (s *Synchronized) GetConsoleURL() (*types.ConsoleResult, error) {
 	return s.underlying.GetConsoleURL()
 }
 
@@ -161,7 +162,7 @@ func (s *Synchronized) PowerOff() error {
 	return s.underlying.PowerOff()
 }
 
-func (s *Synchronized) Status() (*ClusterStatusResult, error) {
+func (s *Synchronized) Status() (*types.ClusterStatusResult, error) {
 	return s.underlying.Status()
 }
 


Test patch:
diff --git a/pkg/crc/machine/sync_test.go b/pkg/crc/machine/sync_test.go
index 765fed386..7214a78d6 100644
--- a/pkg/crc/machine/sync_test.go
+++ b/pkg/crc/machine/sync_test.go
@@ -6,6 +6,7 @@ import (
 	"sync"
 	"testing"
 
+	"github.com/code-ready/crc/pkg/crc/machine/types"
 	"github.com/code-ready/machine/libmachine/state"
 	"github.com/stretchr/testify/assert"
 )
@@ -24,14 +25,14 @@ func TestOneStartAtTheSameTime(t *testing.T) {
 	lock.Add(1)
 	go func() {
 		defer lock.Done()
-		_, err := syncMachine.Start(context.Background(), StartConfig{})
+		_, err := syncMachine.Start(context.Background(), types.StartConfig{})
 		assert.NoError(t, err)
 	}()
 
 	<-isRunning
 	assert.Equal(t, Starting, syncMachine.CurrentState())
 	assert.Equal(t, waitingMachine.GetName(), syncMachine.GetName())
-	_, err := syncMachine.Start(context.Background(), StartConfig{})
+	_, err := syncMachine.Start(context.Background(), types.StartConfig{})
 	assert.EqualError(t, err, "cluster is busy")
 
 	startCh <- struct{}{}
@@ -62,7 +63,7 @@ func TestDeleteStop(t *testing.T) {
 	assert.EqualError(t, syncMachine.Delete(), "cluster is stopping or deleting")
 	_, err := syncMachine.Stop()
 	assert.EqualError(t, err, "cluster is stopping or deleting")
-	_, err = syncMachine.Start(context.Background(), StartConfig{})
+	_, err = syncMachine.Start(context.Background(), types.StartConfig{})
 	assert.EqualError(t, err, "cluster is busy")
 
 	deleteCh <- struct{}{}
@@ -86,7 +87,7 @@ func TestCancelStart(t *testing.T) {
 	lock.Add(1)
 	go func() {
 		defer lock.Done()
-		_, err := syncMachine.Start(context.Background(), StartConfig{})
+		_, err := syncMachine.Start(context.Background(), types.StartConfig{})
 		assert.EqualError(t, err, "context canceled")
 	}()
 
@@ -130,7 +131,7 @@ func (m *waitingMachine) Exists() (bool, error) {
 	return false, errors.New("not implemented")
 }
 
-func (m *waitingMachine) GetConsoleURL() (*ConsoleResult, error) {
+func (m *waitingMachine) GetConsoleURL() (*types.ConsoleResult, error) {
 	return nil, errors.New("not implemented")
 }
 
@@ -142,20 +143,20 @@ func (m *waitingMachine) PowerOff() error {
 	return nil
 }
 
-func (m *waitingMachine) Start(context context.Context, _ StartConfig) (*StartResult, error) {
+func (m *waitingMachine) Start(context context.Context, _ types.StartConfig) (*types.StartResult, error) {
 	m.isRunning <- struct{}{}
 	select {
 	case <-context.Done():
 		return nil, context.Err()
 	case <-m.startCompleteCh:
-		return &StartResult{
+		return &types.StartResult{
 			Status:         state.Running,
 			KubeletStarted: true,
 		}, nil
 	}
 }
 
-func (m *waitingMachine) Status() (*ClusterStatusResult, error) {
+func (m *waitingMachine) Status() (*types.ClusterStatusResult, error) {
 	return nil, errors.New("not implemented")
 }