Integration test on master, not just apiserver.

Moved code from cmd/apiserver to pkg/master.

test/integration/client_test made to use a master object,
instead of an apiserver.Handle.

Subsequent PRs will move more handler-installation into
pkg/master, with the goal that every http.Handler of a
standalone apiserver process can also be tested
in a "testing"-style go test.

In particular, a subsequent PR will test
authorization.
This commit is contained in:
Eric Tune
2014-10-23 13:56:18 -07:00
parent dc7e3d6601
commit 40a5ca034d
5 changed files with 58 additions and 45 deletions

View File

@@ -34,7 +34,6 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/controller"
"github.com/GoogleCloudPlatform/kubernetes/pkg/health"
@@ -132,17 +131,18 @@ func startComponents(manifestURL string) (apiServerURL string) {
if err != nil {
glog.Fatalf("Unable to parse CIDR: %v", err)
}
m := master.New(&master.Config{
Client: cl,
EtcdHelper: helper,
Minions: machineList,
KubeletClient: fakeKubeletClient{},
PortalNet: portalNet,
})
mux := http.NewServeMux()
apiserver.NewAPIGroup(m.API_v1beta1()).InstallREST(mux, "/api/v1beta1")
apiserver.NewAPIGroup(m.API_v1beta2()).InstallREST(mux, "/api/v1beta2")
apiserver.InstallSupport(mux)
// Create a master and install handlers into mux.
master.New(&master.Config{
Client: cl,
EtcdHelper: helper,
Minions: machineList,
KubeletClient: fakeKubeletClient{},
PortalNet: portalNet,
Mux: mux,
EnableLogsSupport: false,
APIPrefix: "/api",
})
handler.delegate = mux
// Scheduler