Fixup unit tests

This commit is contained in:
derekwaynecarr
2014-10-23 16:55:48 -04:00
parent 341e404290
commit c6eb371c93
6 changed files with 52 additions and 55 deletions

View File

@@ -32,7 +32,7 @@ func TestServices(t *testing.T) {
fakeWatch := watch.NewFake()
fakeClient := &client.Fake{Watch: fakeWatch}
services := make(chan ServiceUpdate)
source := SourceAPI{client: fakeClient, services: services}
source := SourceAPI{servicesWatcher: fakeClient.Services(api.NamespaceAll), endpointsWatcher: fakeClient.Endpoints(api.NamespaceAll), services: services}
resourceVersion := "1"
go func() {
// called twice
@@ -84,7 +84,7 @@ func TestServicesFromZero(t *testing.T) {
},
}
services := make(chan ServiceUpdate)
source := SourceAPI{client: fakeClient, services: services}
source := SourceAPI{servicesWatcher: fakeClient.Services(api.NamespaceAll), endpointsWatcher: fakeClient.Endpoints(api.NamespaceAll), services: services}
resourceVersion := ""
ch := make(chan struct{})
go func() {
@@ -112,7 +112,7 @@ func TestServicesFromZero(t *testing.T) {
func TestServicesError(t *testing.T) {
fakeClient := &client.Fake{Err: errors.New("test")}
services := make(chan ServiceUpdate)
source := SourceAPI{client: fakeClient, services: services}
source := SourceAPI{servicesWatcher: fakeClient.Services(api.NamespaceAll), endpointsWatcher: fakeClient.Endpoints(api.NamespaceAll), services: services}
resourceVersion := "1"
ch := make(chan struct{})
go func() {
@@ -133,7 +133,7 @@ func TestServicesError(t *testing.T) {
func TestServicesFromZeroError(t *testing.T) {
fakeClient := &client.Fake{Err: errors.New("test")}
services := make(chan ServiceUpdate)
source := SourceAPI{client: fakeClient, services: services}
source := SourceAPI{servicesWatcher: fakeClient.Services(api.NamespaceAll), endpointsWatcher: fakeClient.Endpoints(api.NamespaceAll), services: services}
resourceVersion := ""
ch := make(chan struct{})
go func() {
@@ -157,7 +157,7 @@ func TestEndpoints(t *testing.T) {
fakeWatch := watch.NewFake()
fakeClient := &client.Fake{Watch: fakeWatch}
endpoints := make(chan EndpointsUpdate)
source := SourceAPI{client: fakeClient, endpoints: endpoints}
source := SourceAPI{servicesWatcher: fakeClient.Services(api.NamespaceAll), endpointsWatcher: fakeClient.Endpoints(api.NamespaceAll), endpoints: endpoints}
resourceVersion := "1"
go func() {
// called twice
@@ -209,7 +209,7 @@ func TestEndpointsFromZero(t *testing.T) {
},
}
endpoints := make(chan EndpointsUpdate)
source := SourceAPI{client: fakeClient, endpoints: endpoints}
source := SourceAPI{servicesWatcher: fakeClient.Services(api.NamespaceAll), endpointsWatcher: fakeClient.Endpoints(api.NamespaceAll), endpoints: endpoints}
resourceVersion := ""
ch := make(chan struct{})
go func() {
@@ -237,7 +237,7 @@ func TestEndpointsFromZero(t *testing.T) {
func TestEndpointsError(t *testing.T) {
fakeClient := &client.Fake{Err: errors.New("test")}
endpoints := make(chan EndpointsUpdate)
source := SourceAPI{client: fakeClient, endpoints: endpoints}
source := SourceAPI{servicesWatcher: fakeClient.Services(api.NamespaceAll), endpointsWatcher: fakeClient.Endpoints(api.NamespaceAll), endpoints: endpoints}
resourceVersion := "1"
ch := make(chan struct{})
go func() {
@@ -258,7 +258,7 @@ func TestEndpointsError(t *testing.T) {
func TestEndpointsFromZeroError(t *testing.T) {
fakeClient := &client.Fake{Err: errors.New("test")}
endpoints := make(chan EndpointsUpdate)
source := SourceAPI{client: fakeClient, endpoints: endpoints}
source := SourceAPI{servicesWatcher: fakeClient.Services(api.NamespaceAll), endpointsWatcher: fakeClient.Endpoints(api.NamespaceAll), endpoints: endpoints}
resourceVersion := ""
ch := make(chan struct{})
go func() {