forked from rhd-gitops-example/odo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fakeclient.go
57 lines (45 loc) · 2.47 KB
/
fakeclient.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package occlient
import (
fakeServiceCatalogClientSet "github.com/kubernetes-incubator/service-catalog/pkg/client/clientset_generated/clientset/fake"
fakeAppsClientset "github.com/openshift/client-go/apps/clientset/versioned/fake"
fakeBuildClientset "github.com/openshift/client-go/build/clientset/versioned/fake"
fakeImageClientset "github.com/openshift/client-go/image/clientset/versioned/fake"
fakeProjClientset "github.com/openshift/client-go/project/clientset/versioned/fake"
fakeRouteClientset "github.com/openshift/client-go/route/clientset/versioned/fake"
fakeKubeClientset "k8s.io/client-go/kubernetes/fake"
)
// FakeClientset holds fake ClientSets
// this is returned by FakeNew to access methods of fake client sets
type FakeClientset struct {
Kubernetes *fakeKubeClientset.Clientset
AppsClientset *fakeAppsClientset.Clientset
BuildClientset *fakeBuildClientset.Clientset
ImageClientset *fakeImageClientset.Clientset
RouteClientset *fakeRouteClientset.Clientset
ProjClientset *fakeProjClientset.Clientset
ServiceCatalogClientSet *fakeServiceCatalogClientSet.Clientset
}
// FakeNew creates new fake client for testing
// returns Client that is filled with fake clients and
// FakeClientSet that holds fake Clientsets to access Actions, Reactors etc... in fake client
func FakeNew() (*Client, *FakeClientset) {
var client Client
var fkclientset FakeClientset
fkclientset.Kubernetes = fakeKubeClientset.NewSimpleClientset()
client.kubeClient = fkclientset.Kubernetes
fkclientset.AppsClientset = fakeAppsClientset.NewSimpleClientset()
client.appsClient = fkclientset.AppsClientset.Apps()
fkclientset.BuildClientset = fakeBuildClientset.NewSimpleClientset()
client.buildClient = fkclientset.BuildClientset.Build()
fkclientset.RouteClientset = fakeRouteClientset.NewSimpleClientset()
client.routeClient = fkclientset.RouteClientset.Route()
fkclientset.ImageClientset = fakeImageClientset.NewSimpleClientset()
client.imageClient = fkclientset.ImageClientset.Image()
fkclientset.ProjClientset = fakeProjClientset.NewSimpleClientset()
client.projectClient = fkclientset.ProjClientset.Project()
fkclientset.BuildClientset = fakeBuildClientset.NewSimpleClientset()
client.buildClient = fkclientset.BuildClientset.Build()
fkclientset.ServiceCatalogClientSet = fakeServiceCatalogClientSet.NewSimpleClientset()
client.serviceCatalogClient = fkclientset.ServiceCatalogClientSet.Servicecatalog()
return &client, &fkclientset
}