Browse code

Update integration tests

Clayton Coleman authored on 2014/09/23 13:41:44
Showing 3 changed files
... ...
@@ -8,13 +8,16 @@ import (
8 8
 	"reflect"
9 9
 	"testing"
10 10
 
11
+	klatest "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
11 12
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
12 13
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
13 14
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
14 15
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/master"
15
-	"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
16
+	"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
16 17
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
17 18
 
19
+	"github.com/openshift/origin/pkg/api/latest"
20
+	"github.com/openshift/origin/pkg/api/v1beta1"
18 21
 	"github.com/openshift/origin/pkg/build/api"
19 22
 	buildregistry "github.com/openshift/origin/pkg/build/registry/build"
20 23
 	buildconfigregistry "github.com/openshift/origin/pkg/build/registry/buildconfig"
... ...
@@ -28,23 +31,25 @@ func init() {
28 28
 
29 29
 func TestBuildConfigClient(t *testing.T) {
30 30
 	etcdClient := newEtcdClient()
31
+	helper, _ := master.NewEtcdHelper(etcdClient.GetCluster(), klatest.Version)
31 32
 	m := master.New(&master.Config{
32
-		EtcdServers: etcdClient.GetCluster(),
33
+		EtcdHelper: helper,
33 34
 	})
34
-	osMux := http.NewServeMux()
35
-	buildRegistry := buildetcd.NewEtcd(etcdClient)
35
+	codec, versioner, _ := latest.InterfacesFor(latest.Version)
36
+	buildRegistry := buildetcd.New(tools.EtcdHelper{etcdClient, codec, versioner})
36 37
 	storage := map[string]apiserver.RESTStorage{
37 38
 		"builds":       buildregistry.NewREST(buildRegistry),
38 39
 		"buildConfigs": buildconfigregistry.NewREST(buildRegistry),
39 40
 	}
41
+
42
+	osMux := http.NewServeMux()
40 43
 	apiserver.NewAPIGroup(m.API_v1beta1()).InstallREST(osMux, "/api/v1beta1")
41
-	apiserver.NewAPIGroup(storage, runtime.Codec).InstallREST(osMux, "/osapi/v1beta1")
44
+	apiserver.NewAPIGroup(storage, v1beta1.Codec).InstallREST(osMux, "/osapi/v1beta1")
42 45
 	apiserver.InstallSupport(osMux)
43
-
44 46
 	s := httptest.NewServer(osMux)
45 47
 
46
-	kubeclient := client.NewOrDie(s.URL, nil)
47
-	osclient, _ := osclient.New(s.URL, nil)
48
+	kubeclient := client.NewOrDie(s.URL, klatest.Version, nil)
49
+	osclient, _ := osclient.New(s.URL, latest.Version, nil)
48 50
 
49 51
 	info, err := kubeclient.ServerVersion()
50 52
 	if err != nil {
... ...
@@ -8,13 +8,16 @@ import (
8 8
 	"reflect"
9 9
 	"testing"
10 10
 
11
+	klatest "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
11 12
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
12 13
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
13 14
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
14 15
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/master"
15
-	"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
16
+	"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
16 17
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
17 18
 
19
+	"github.com/openshift/origin/pkg/api/latest"
20
+	"github.com/openshift/origin/pkg/api/v1beta1"
18 21
 	"github.com/openshift/origin/pkg/build/api"
19 22
 	buildregistry "github.com/openshift/origin/pkg/build/registry/build"
20 23
 	buildconfigregistry "github.com/openshift/origin/pkg/build/registry/buildconfig"
... ...
@@ -28,23 +31,25 @@ func init() {
28 28
 
29 29
 func TestBuildClient(t *testing.T) {
30 30
 	etcdClient := newEtcdClient()
31
+	helper, _ := master.NewEtcdHelper(etcdClient.GetCluster(), klatest.Version)
31 32
 	m := master.New(&master.Config{
32
-		EtcdServers: etcdClient.GetCluster(),
33
+		EtcdHelper: helper,
33 34
 	})
34
-	osMux := http.NewServeMux()
35
-	buildRegistry := buildetcd.NewEtcd(etcdClient)
35
+	codec, versioner, _ := latest.InterfacesFor(latest.Version)
36
+	buildRegistry := buildetcd.New(tools.EtcdHelper{etcdClient, codec, versioner})
36 37
 	storage := map[string]apiserver.RESTStorage{
37 38
 		"builds":       buildregistry.NewREST(buildRegistry),
38 39
 		"buildConfigs": buildconfigregistry.NewREST(buildRegistry),
39 40
 	}
41
+
42
+	osMux := http.NewServeMux()
40 43
 	apiserver.NewAPIGroup(m.API_v1beta1()).InstallREST(osMux, "/api/v1beta1")
41
-	apiserver.NewAPIGroup(storage, runtime.Codec).InstallREST(osMux, "/osapi/v1beta1")
44
+	apiserver.NewAPIGroup(storage, v1beta1.Codec).InstallREST(osMux, "/osapi/v1beta1")
42 45
 	apiserver.InstallSupport(osMux)
43
-
44 46
 	s := httptest.NewServer(osMux)
45 47
 
46
-	kubeclient := client.NewOrDie(s.URL, nil)
47
-	osclient, _ := osclient.New(s.URL, nil)
48
+	kubeclient := client.NewOrDie(s.URL, klatest.Version, nil)
49
+	osclient, _ := osclient.New(s.URL, latest.Version, nil)
48 50
 
49 51
 	info, err := kubeclient.ServerVersion()
50 52
 	if err != nil {
... ...
@@ -11,13 +11,16 @@ import (
11 11
 	"testing"
12 12
 
13 13
 	kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
14
+	klatest "github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
14 15
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
15 16
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
16 17
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
17 18
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/master"
18
-	"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
19
+	"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
19 20
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
20 21
 
22
+	"github.com/openshift/origin/pkg/api/latest"
23
+	"github.com/openshift/origin/pkg/api/v1beta1"
21 24
 	buildapi "github.com/openshift/origin/pkg/build/api"
22 25
 	buildregistry "github.com/openshift/origin/pkg/build/registry/build"
23 26
 	buildconfigregistry "github.com/openshift/origin/pkg/build/registry/buildconfig"
... ...
@@ -108,24 +111,26 @@ func TestWebhookGithubPing(t *testing.T) {
108 108
 
109 109
 func setup(t *testing.T) (*osclient.Client, string) {
110 110
 	etcdClient := newEtcdClient()
111
+	helper, _ := master.NewEtcdHelper(etcdClient.GetCluster(), klatest.Version)
111 112
 	m := master.New(&master.Config{
112
-		EtcdServers: etcdClient.GetCluster(),
113
+		EtcdHelper: helper,
113 114
 	})
114
-	osMux := http.NewServeMux()
115
-	buildRegistry := buildetcd.NewEtcd(etcdClient)
115
+	codec, versioner, _ := latest.InterfacesFor(latest.Version)
116
+	buildRegistry := buildetcd.New(tools.EtcdHelper{etcdClient, codec, versioner})
116 117
 	storage := map[string]apiserver.RESTStorage{
117 118
 		"builds":       buildregistry.NewREST(buildRegistry),
118 119
 		"buildConfigs": buildconfigregistry.NewREST(buildRegistry),
119 120
 	}
121
+
122
+	osMux := http.NewServeMux()
120 123
 	apiserver.NewAPIGroup(m.API_v1beta1()).InstallREST(osMux, "/api/v1beta1")
121 124
 	osPrefix := "/osapi/v1beta1"
122
-	apiserver.NewAPIGroup(storage, runtime.Codec).InstallREST(osMux, osPrefix)
125
+	apiserver.NewAPIGroup(storage, v1beta1.Codec).InstallREST(osMux, osPrefix)
123 126
 	apiserver.InstallSupport(osMux)
124
-
125 127
 	s := httptest.NewServer(osMux)
126 128
 
127
-	kubeclient := client.NewOrDie(s.URL, nil)
128
-	osClient, _ := osclient.New(s.URL, nil)
129
+	kubeclient := client.NewOrDie(s.URL, klatest.Version, nil)
130
+	osClient, _ := osclient.New(s.URL, latest.Version, nil)
129 131
 
130 132
 	whPrefix := osPrefix + "/buildConfigHooks/"
131 133
 	osMux.Handle(whPrefix, http.StripPrefix(whPrefix,