mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
address test & doc comments
This commit is contained in:
parent
2f1ea47c83
commit
3528ceb27f
@ -1102,6 +1102,7 @@ func (c *Cloud) ExternalID(nodeName types.NodeName) (string, error) {
|
||||
}
|
||||
|
||||
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
|
||||
// If false is returned with no error, the instance will be immediately deleted.
|
||||
func (c *Cloud) InstanceExistsByProviderID(providerID string) (bool, error) {
|
||||
return false, errors.New("unimplemented")
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ func (az *Cloud) ExternalID(name types.NodeName) (string, error) {
|
||||
}
|
||||
|
||||
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
|
||||
// If false is returned with no error, the instance will be immediately deleted.
|
||||
func (az *Cloud) InstanceExistsByProviderID(providerID string) (bool, error) {
|
||||
return false, errors.New("unimplemented")
|
||||
}
|
||||
|
@ -239,6 +239,7 @@ func (f *FakeCloud) InstanceTypeByProviderID(providerID string) (string, error)
|
||||
}
|
||||
|
||||
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
|
||||
// If false is returned with no error, the instance will be immediately deleted.
|
||||
func (f *FakeCloud) InstanceExistsByProviderID(providerID string) (bool, error) {
|
||||
f.addCall("instance-exists-by-provider-id")
|
||||
return f.ExistsByProviderID, f.ErrByProviderID
|
||||
|
@ -153,6 +153,7 @@ func (gce *GCECloud) ExternalID(nodeName types.NodeName) (string, error) {
|
||||
}
|
||||
|
||||
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
|
||||
// If false is returned with no error, the instance will be immediately deleted.
|
||||
func (gce *GCECloud) InstanceExistsByProviderID(providerID string) (bool, error) {
|
||||
return false, errors.New("unimplemented")
|
||||
}
|
||||
|
@ -111,6 +111,7 @@ func (i *Instances) ExternalID(name types.NodeName) (string, error) {
|
||||
}
|
||||
|
||||
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
|
||||
// If false is returned with no error, the instance will be immediately deleted.
|
||||
func (i *Instances) InstanceExistsByProviderID(providerID string) (bool, error) {
|
||||
return false, errors.New("unimplemented")
|
||||
}
|
||||
|
@ -212,6 +212,7 @@ func (v *OVirtCloud) ExternalID(nodeName types.NodeName) (string, error) {
|
||||
}
|
||||
|
||||
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
|
||||
// If false is returned with no error, the instance will be immediately deleted.
|
||||
func (v *OVirtCloud) InstanceExistsByProviderID(providerID string) (bool, error) {
|
||||
return false, errors.New("unimplemented")
|
||||
}
|
||||
|
@ -471,6 +471,7 @@ func (pc *PCCloud) ExternalID(nodeName k8stypes.NodeName) (string, error) {
|
||||
}
|
||||
|
||||
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
|
||||
// If false is returned with no error, the instance will be immediately deleted.
|
||||
func (pc *PCCloud) InstanceExistsByProviderID(providerID string) (bool, error) {
|
||||
return false, errors.New("unimplemented")
|
||||
}
|
||||
|
@ -437,6 +437,7 @@ func (i *Instances) ExternalID(nodeName types.NodeName) (string, error) {
|
||||
}
|
||||
|
||||
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
|
||||
// If false is returned with no error, the instance will be immediately deleted.
|
||||
func (i *Instances) InstanceExistsByProviderID(providerID string) (bool, error) {
|
||||
return false, errors.New("unimplemented")
|
||||
}
|
||||
|
@ -377,6 +377,7 @@ func (vs *VSphere) ExternalID(nodeName k8stypes.NodeName) (string, error) {
|
||||
}
|
||||
|
||||
// InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running.
|
||||
// If false is returned with no error, the instance will be immediately deleted.
|
||||
func (vs *VSphere) InstanceExistsByProviderID(providerID string) (bool, error) {
|
||||
return false, errors.New("unimplemented")
|
||||
}
|
||||
|
@ -130,23 +130,23 @@ func TestEnsureNodeExistsByProviderIDOrNodeName(t *testing.T) {
|
||||
instances, _ := fc.Instances()
|
||||
exists, err := ensureNodeExistsByProviderIDOrName(instances, tc.node)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(fc.Calls, tc.expectedCalls) {
|
||||
t.Fatalf("expected cloud provider methods `%v` to be called but `%v` was called ", tc.expectedCalls, fc.Calls)
|
||||
t.Errorf("expected cloud provider methods `%v` to be called but `%v` was called ", tc.expectedCalls, fc.Calls)
|
||||
}
|
||||
|
||||
if tc.existsByProviderID && tc.existsByProviderID != exists {
|
||||
t.Fatalf("expected exist by provider id to be `%t` but got `%t`", tc.existsByProviderID, exists)
|
||||
t.Errorf("expected exist by provider id to be `%t` but got `%t`", tc.existsByProviderID, exists)
|
||||
}
|
||||
|
||||
if tc.existsByNodeName && tc.existsByNodeName != exists {
|
||||
t.Fatalf("expected exist by node name to be `%t` but got `%t`", tc.existsByNodeName, exists)
|
||||
t.Errorf("expected exist by node name to be `%t` but got `%t`", tc.existsByNodeName, exists)
|
||||
}
|
||||
|
||||
if !tc.existsByNodeName && !tc.existsByProviderID && exists {
|
||||
t.Fatal("node is not supposed to exist")
|
||||
t.Error("node is not supposed to exist")
|
||||
}
|
||||
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user