address test & doc comments

This commit is contained in:
Josh Horwitz 2017-08-25 16:15:55 -04:00
parent 2f1ea47c83
commit 3528ceb27f
10 changed files with 14 additions and 5 deletions

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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")
}
})