diff --git a/pkg/cloudprovider/fake_cloud.go b/pkg/cloudprovider/fake/fake.go similarity index 89% rename from pkg/cloudprovider/fake_cloud.go rename to pkg/cloudprovider/fake/fake.go index da16f336fd..3b4fe7c1f4 100644 --- a/pkg/cloudprovider/fake_cloud.go +++ b/pkg/cloudprovider/fake/fake.go @@ -14,11 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cloudprovider +package fake_cloud import ( "net" "regexp" + + "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider" ) // FakeCloud is a test-double implementation of Interface, TCPLoadBalancer and Instances. It is useful for testing. @@ -28,7 +30,7 @@ type FakeCloud struct { Calls []string IP net.IP Machines []string - Zone + cloudprovider.Zone } func (f *FakeCloud) addCall(desc string) { @@ -43,18 +45,18 @@ func (f *FakeCloud) ClearCalls() { // TCPLoadBalancer returns a fake implementation of TCPLoadBalancer. // // Actually it just returns f itself. -func (f *FakeCloud) TCPLoadBalancer() (TCPLoadBalancer, bool) { +func (f *FakeCloud) TCPLoadBalancer() (cloudprovider.TCPLoadBalancer, bool) { return f, true } // Instances returns a fake implementation of Instances. // // Actually it just returns f itself. -func (f *FakeCloud) Instances() (Instances, bool) { +func (f *FakeCloud) Instances() (cloudprovider.Instances, bool) { return f, true } -func (f *FakeCloud) Zones() (Zones, bool) { +func (f *FakeCloud) Zones() (cloudprovider.Zones, bool) { return f, true } @@ -104,7 +106,7 @@ func (f *FakeCloud) List(filter string) ([]string, error) { return result, f.Err } -func (f *FakeCloud) GetZone() (Zone, error) { +func (f *FakeCloud) GetZone() (cloudprovider.Zone, error) { f.addCall("get-zone") return f.Zone, f.Err } diff --git a/pkg/registry/minion/cloud_registry_test.go b/pkg/registry/minion/cloud_registry_test.go index 1b1fb08e91..d325b91b25 100644 --- a/pkg/registry/minion/cloud_registry_test.go +++ b/pkg/registry/minion/cloud_registry_test.go @@ -20,12 +20,12 @@ import ( "reflect" "testing" - "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider" + "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/fake" ) func TestCloudList(t *testing.T) { instances := []string{"m1", "m2"} - fakeCloud := cloudprovider.FakeCloud{ + fakeCloud := fake_cloud.FakeCloud{ Machines: instances, } registry, err := NewCloudRegistry(&fakeCloud, ".*") @@ -45,7 +45,7 @@ func TestCloudList(t *testing.T) { func TestCloudContains(t *testing.T) { instances := []string{"m1", "m2"} - fakeCloud := cloudprovider.FakeCloud{ + fakeCloud := fake_cloud.FakeCloud{ Machines: instances, } registry, err := NewCloudRegistry(&fakeCloud, ".*") @@ -74,7 +74,7 @@ func TestCloudContains(t *testing.T) { func TestCloudListRegexp(t *testing.T) { instances := []string{"m1", "m2", "n1", "n2"} - fakeCloud := cloudprovider.FakeCloud{ + fakeCloud := fake_cloud.FakeCloud{ Machines: instances, } registry, err := NewCloudRegistry(&fakeCloud, "m[0-9]+") diff --git a/pkg/registry/pod/storage_test.go b/pkg/registry/pod/storage_test.go index dfa7627494..d047ae4e70 100644 --- a/pkg/registry/pod/storage_test.go +++ b/pkg/registry/pod/storage_test.go @@ -23,7 +23,7 @@ import ( "time" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider" + "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/fake" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/minion" "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/registrytest" @@ -228,7 +228,7 @@ func TestGetPod(t *testing.T) { } func TestGetPodCloud(t *testing.T) { - fakeCloud := &cloudprovider.FakeCloud{} + fakeCloud := &fake_cloud.FakeCloud{} podRegistry := registrytest.NewPodRegistry(nil) podRegistry.Pod = &api.Pod{JSONBase: api.JSONBase{ID: "foo"}} storage := RegistryStorage{ diff --git a/pkg/registry/service/storage_test.go b/pkg/registry/service/storage_test.go index fa92505343..e86f499efa 100644 --- a/pkg/registry/service/storage_test.go +++ b/pkg/registry/service/storage_test.go @@ -21,7 +21,7 @@ import ( "testing" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" - "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider" + "github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider/fake" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels" "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/minion" "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/registrytest" @@ -30,7 +30,7 @@ import ( func TestServiceRegistryCreate(t *testing.T) { registry := registrytest.NewServiceRegistry() - fakeCloud := &cloudprovider.FakeCloud{} + fakeCloud := &fake_cloud.FakeCloud{} machines := []string{"foo", "bar", "baz"} storage := NewRegistryStorage(registry, fakeCloud, minion.NewRegistry(machines)) svc := &api.Service{ @@ -136,7 +136,7 @@ func TestServiceStorageValidatesUpdate(t *testing.T) { func TestServiceRegistryExternalService(t *testing.T) { registry := registrytest.NewServiceRegistry() - fakeCloud := &cloudprovider.FakeCloud{} + fakeCloud := &fake_cloud.FakeCloud{} machines := []string{"foo", "bar", "baz"} storage := NewRegistryStorage(registry, fakeCloud, minion.NewRegistry(machines)) svc := &api.Service{ @@ -160,7 +160,7 @@ func TestServiceRegistryExternalService(t *testing.T) { func TestServiceRegistryExternalServiceError(t *testing.T) { registry := registrytest.NewServiceRegistry() - fakeCloud := &cloudprovider.FakeCloud{ + fakeCloud := &fake_cloud.FakeCloud{ Err: fmt.Errorf("test error"), } machines := []string{"foo", "bar", "baz"} @@ -182,7 +182,7 @@ func TestServiceRegistryExternalServiceError(t *testing.T) { func TestServiceRegistryDelete(t *testing.T) { registry := registrytest.NewServiceRegistry() - fakeCloud := &cloudprovider.FakeCloud{} + fakeCloud := &fake_cloud.FakeCloud{} machines := []string{"foo", "bar", "baz"} storage := NewRegistryStorage(registry, fakeCloud, minion.NewRegistry(machines)) svc := api.Service{ @@ -202,7 +202,7 @@ func TestServiceRegistryDelete(t *testing.T) { func TestServiceRegistryDeleteExternal(t *testing.T) { registry := registrytest.NewServiceRegistry() - fakeCloud := &cloudprovider.FakeCloud{} + fakeCloud := &fake_cloud.FakeCloud{} machines := []string{"foo", "bar", "baz"} storage := NewRegistryStorage(registry, fakeCloud, minion.NewRegistry(machines)) svc := api.Service{ @@ -245,7 +245,7 @@ func TestServiceRegistryMakeLinkVariables(t *testing.T) { func TestServiceRegistryGet(t *testing.T) { registry := registrytest.NewServiceRegistry() - fakeCloud := &cloudprovider.FakeCloud{} + fakeCloud := &fake_cloud.FakeCloud{} machines := []string{"foo", "bar", "baz"} storage := NewRegistryStorage(registry, fakeCloud, minion.NewRegistry(machines)) registry.CreateService(api.Service{ @@ -263,7 +263,7 @@ func TestServiceRegistryGet(t *testing.T) { func TestServiceRegistryList(t *testing.T) { registry := registrytest.NewServiceRegistry() - fakeCloud := &cloudprovider.FakeCloud{} + fakeCloud := &fake_cloud.FakeCloud{} machines := []string{"foo", "bar", "baz"} storage := NewRegistryStorage(registry, fakeCloud, minion.NewRegistry(machines)) registry.CreateService(api.Service{