mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-23 02:26:52 +00:00
gce: fix test for non-existing instance in cloud
This commit fixes a GCE instance test for a scenario where instance does not exist in the cloud. In the `gce_instances.go` we have a code that handles such a scenario and strips off the error, i.e. ``` if providerID, err = cloudprovider.GetInstanceProviderID(ctx, g, types.NodeName(node.Name)); err != nil { if err == cloudprovider.InstanceNotFound { return false, nil } return false, err } ``` but nevertheless the test was expecing a non-empty error string. This issue got exposed when implementation of `GetInstanceProviderID` in the `cloud-provider/cloud.go` changed to return `InstanceNotFound` as-is and not as a custom string. Signed-off-by: Mat Kowalski <mko@redhat.com>
This commit is contained in:
parent
4a640ea384
commit
60a602f170
@ -21,7 +21,6 @@ package gce
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -55,7 +54,7 @@ func TestInstanceExists(t *testing.T) {
|
|||||||
name: "node not exist",
|
name: "node not exist",
|
||||||
nodeName: "test-node-2",
|
nodeName: "test-node-2",
|
||||||
exist: false,
|
exist: false,
|
||||||
expectedErr: fmt.Errorf("failed to get instance ID from cloud provider: instance not found"),
|
expectedErr: nil,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user