| ... | ... |
@@ -41,11 +41,11 @@ type errKubeClient struct {
|
| 41 | 41 |
kubeclient.Fake |
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 |
-func (_ *errKubeClient) CreatePod(pod *kubeapi.Pod) (*kubeapi.Pod, error) {
|
|
| 44 |
+func (_ *errKubeClient) CreatePod(ctx kubeapi.Context, pod *kubeapi.Pod) (*kubeapi.Pod, error) {
|
|
| 45 | 45 |
return &kubeapi.Pod{}, errors.New("CreatePod error!")
|
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 |
-func (_ *errKubeClient) GetPod(name string) (*kubeapi.Pod, error) {
|
|
| 48 |
+func (_ *errKubeClient) GetPod(ctx kubeapi.Context, name string) (*kubeapi.Pod, error) {
|
|
| 49 | 49 |
return &kubeapi.Pod{}, errors.New("GedPod error!")
|
| 50 | 50 |
} |
| 51 | 51 |
|
| ... | ... |
@@ -53,7 +53,7 @@ type okKubeClient struct {
|
| 53 | 53 |
kubeclient.Fake |
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 |
-func (_ *okKubeClient) GetPod(name string) (*kubeapi.Pod, error) {
|
|
| 56 |
+func (_ *okKubeClient) GetPod(ctx kubeapi.Context, name string) (*kubeapi.Pod, error) {
|
|
| 57 | 57 |
return &kubeapi.Pod{
|
| 58 | 58 |
CurrentState: kubeapi.PodState{Status: kubeapi.PodTerminated},
|
| 59 | 59 |
}, nil |
| ... | ... |
@@ -32,7 +32,7 @@ func TestGetBuild(t *testing.T) {
|
| 32 | 32 |
expectedBuild := mockBuild() |
| 33 | 33 |
mockRegistry := test.BuildRegistry{Build: expectedBuild}
|
| 34 | 34 |
storage := REST{&mockRegistry}
|
| 35 |
- buildObj, err := storage.Get("foo")
|
|
| 35 |
+ buildObj, err := storage.Get(nil, "foo") |
|
| 36 | 36 |
if err != nil {
|
| 37 | 37 |
t.Errorf("Unexpected error returned: %v", err)
|
| 38 | 38 |
} |
| ... | ... |
@@ -48,7 +48,7 @@ func TestGetBuild(t *testing.T) {
|
| 48 | 48 |
func TestGetBuildError(t *testing.T) {
|
| 49 | 49 |
mockRegistry := test.BuildRegistry{Err: fmt.Errorf("get error")}
|
| 50 | 50 |
storage := REST{&mockRegistry}
|
| 51 |
- buildObj, err := storage.Get("foo")
|
|
| 51 |
+ buildObj, err := storage.Get(nil, "foo") |
|
| 52 | 52 |
if err != mockRegistry.Err {
|
| 53 | 53 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 54 | 54 |
} |
| ... | ... |
@@ -61,7 +61,7 @@ func TestDeleteBuild(t *testing.T) {
|
| 61 | 61 |
mockRegistry := test.BuildRegistry{}
|
| 62 | 62 |
buildId := "test-build-id" |
| 63 | 63 |
storage := REST{&mockRegistry}
|
| 64 |
- channel, err := storage.Delete(buildId) |
|
| 64 |
+ channel, err := storage.Delete(nil, buildId) |
|
| 65 | 65 |
if err != nil {
|
| 66 | 66 |
t.Errorf("Unexpected error when deleting: %v", err)
|
| 67 | 67 |
} |
| ... | ... |
@@ -87,7 +87,7 @@ func TestDeleteBuildError(t *testing.T) {
|
| 87 | 87 |
mockRegistry := test.BuildRegistry{Err: fmt.Errorf("Delete error")}
|
| 88 | 88 |
buildId := "test-build-id" |
| 89 | 89 |
storage := REST{&mockRegistry}
|
| 90 |
- channel, _ := storage.Delete(buildId) |
|
| 90 |
+ channel, _ := storage.Delete(nil, buildId) |
|
| 91 | 91 |
select {
|
| 92 | 92 |
case result := <-channel: |
| 93 | 93 |
status, ok := result.(*kubeapi.Status) |
| ... | ... |
@@ -107,7 +107,7 @@ func TestListBuildsError(t *testing.T) {
|
| 107 | 107 |
Err: fmt.Errorf("test error"),
|
| 108 | 108 |
} |
| 109 | 109 |
storage := REST{&mockRegistry}
|
| 110 |
- builds, err := storage.List(nil, nil) |
|
| 110 |
+ builds, err := storage.List(nil, nil, nil) |
|
| 111 | 111 |
if err != mockRegistry.Err {
|
| 112 | 112 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 113 | 113 |
} |
| ... | ... |
@@ -119,7 +119,7 @@ func TestListBuildsError(t *testing.T) {
|
| 119 | 119 |
func TestListEmptyBuildList(t *testing.T) {
|
| 120 | 120 |
mockRegistry := test.BuildRegistry{Builds: &api.BuildList{JSONBase: kubeapi.JSONBase{ResourceVersion: 1}}}
|
| 121 | 121 |
storage := REST{&mockRegistry}
|
| 122 |
- builds, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 122 |
+ builds, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 123 | 123 |
if err != nil {
|
| 124 | 124 |
t.Errorf("unexpected error: %v", err)
|
| 125 | 125 |
} |
| ... | ... |
@@ -150,7 +150,7 @@ func TestListBuilds(t *testing.T) {
|
| 150 | 150 |
}, |
| 151 | 151 |
} |
| 152 | 152 |
storage := REST{registry: &mockRegistry}
|
| 153 |
- buildsObj, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 153 |
+ buildsObj, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 154 | 154 |
builds := buildsObj.(*api.BuildList) |
| 155 | 155 |
if err != nil {
|
| 156 | 156 |
t.Errorf("unexpected error: %v", err)
|
| ... | ... |
@@ -233,7 +233,7 @@ func TestCreateBuild(t *testing.T) {
|
| 233 | 233 |
mockRegistry := test.BuildRegistry{}
|
| 234 | 234 |
storage := REST{&mockRegistry}
|
| 235 | 235 |
build := mockBuild() |
| 236 |
- channel, err := storage.Create(build) |
|
| 236 |
+ channel, err := storage.Create(nil, build) |
|
| 237 | 237 |
if err != nil {
|
| 238 | 238 |
t.Errorf("unexpected error: %v", err)
|
| 239 | 239 |
} |
| ... | ... |
@@ -260,7 +260,7 @@ func TestUpdateBuild(t *testing.T) {
|
| 260 | 260 |
mockRegistry := test.BuildRegistry{}
|
| 261 | 261 |
storage := REST{&mockRegistry}
|
| 262 | 262 |
build := mockBuild() |
| 263 |
- channel, err := storage.Update(build) |
|
| 263 |
+ channel, err := storage.Update(nil, build) |
|
| 264 | 264 |
if err != nil {
|
| 265 | 265 |
t.Errorf("unexpected error: %v", err)
|
| 266 | 266 |
} |
| ... | ... |
@@ -287,7 +287,7 @@ func TestUpdateBuildError(t *testing.T) {
|
| 287 | 287 |
mockRegistry := test.BuildRegistry{Err: fmt.Errorf("Update error")}
|
| 288 | 288 |
storage := REST{&mockRegistry}
|
| 289 | 289 |
build := mockBuild() |
| 290 |
- channel, err := storage.Update(build) |
|
| 290 |
+ channel, err := storage.Update(nil, build) |
|
| 291 | 291 |
if err != nil {
|
| 292 | 292 |
t.Errorf("unexpected error: %v", err)
|
| 293 | 293 |
} |
| ... | ... |
@@ -316,7 +316,7 @@ func TestBuildRESTValidatesCreate(t *testing.T) {
|
| 316 | 316 |
}, |
| 317 | 317 |
} |
| 318 | 318 |
for desc, failureCase := range failureCases {
|
| 319 |
- c, err := storage.Create(&failureCase) |
|
| 319 |
+ c, err := storage.Create(nil, &failureCase) |
|
| 320 | 320 |
if c != nil {
|
| 321 | 321 |
t.Errorf("%s: Expected nil channel", desc)
|
| 322 | 322 |
} |
| ... | ... |
@@ -344,7 +344,7 @@ func TestBuildRESTValidatesUpdate(t *testing.T) {
|
| 344 | 344 |
}, |
| 345 | 345 |
} |
| 346 | 346 |
for desc, failureCase := range failureCases {
|
| 347 |
- c, err := storage.Update(&failureCase) |
|
| 347 |
+ c, err := storage.Update(nil, &failureCase) |
|
| 348 | 348 |
if c != nil {
|
| 349 | 349 |
t.Errorf("%s: Expected nil channel", desc)
|
| 350 | 350 |
} |
| ... | ... |
@@ -32,7 +32,7 @@ func TestGetConfig(t *testing.T) {
|
| 32 | 32 |
expectedConfig := mockBuildConfig() |
| 33 | 33 |
mockRegistry := test.BuildConfigRegistry{BuildConfig: expectedConfig}
|
| 34 | 34 |
storage := REST{&mockRegistry}
|
| 35 |
- configObj, err := storage.Get("foo")
|
|
| 35 |
+ configObj, err := storage.Get(nil, "foo") |
|
| 36 | 36 |
if err != nil {
|
| 37 | 37 |
t.Errorf("Unexpected error returned: %v", err)
|
| 38 | 38 |
} |
| ... | ... |
@@ -48,7 +48,7 @@ func TestGetConfig(t *testing.T) {
|
| 48 | 48 |
func TestGetConfigError(t *testing.T) {
|
| 49 | 49 |
mockRegistry := test.BuildConfigRegistry{Err: fmt.Errorf("get error")}
|
| 50 | 50 |
storage := REST{&mockRegistry}
|
| 51 |
- buildObj, err := storage.Get("foo")
|
|
| 51 |
+ buildObj, err := storage.Get(nil, "foo") |
|
| 52 | 52 |
if err != mockRegistry.Err {
|
| 53 | 53 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 54 | 54 |
} |
| ... | ... |
@@ -61,7 +61,7 @@ func TestDeleteBuild(t *testing.T) {
|
| 61 | 61 |
mockRegistry := test.BuildConfigRegistry{}
|
| 62 | 62 |
configId := "test-config-id" |
| 63 | 63 |
storage := REST{&mockRegistry}
|
| 64 |
- channel, err := storage.Delete(configId) |
|
| 64 |
+ channel, err := storage.Delete(nil, configId) |
|
| 65 | 65 |
if err != nil {
|
| 66 | 66 |
t.Errorf("Unexpected error when deleting: %v", err)
|
| 67 | 67 |
} |
| ... | ... |
@@ -87,7 +87,7 @@ func TestDeleteBuildError(t *testing.T) {
|
| 87 | 87 |
mockRegistry := test.BuildConfigRegistry{Err: fmt.Errorf("Delete error")}
|
| 88 | 88 |
configId := "test-config-id" |
| 89 | 89 |
storage := REST{&mockRegistry}
|
| 90 |
- channel, _ := storage.Delete(configId) |
|
| 90 |
+ channel, _ := storage.Delete(nil, configId) |
|
| 91 | 91 |
select {
|
| 92 | 92 |
case result := <-channel: |
| 93 | 93 |
status, ok := result.(*kubeapi.Status) |
| ... | ... |
@@ -107,7 +107,7 @@ func TestListConfigsError(t *testing.T) {
|
| 107 | 107 |
Err: fmt.Errorf("test error"),
|
| 108 | 108 |
} |
| 109 | 109 |
storage := REST{&mockRegistry}
|
| 110 |
- configs, err := storage.List(nil, nil) |
|
| 110 |
+ configs, err := storage.List(nil, nil, nil) |
|
| 111 | 111 |
if err != mockRegistry.Err {
|
| 112 | 112 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 113 | 113 |
} |
| ... | ... |
@@ -119,7 +119,7 @@ func TestListConfigsError(t *testing.T) {
|
| 119 | 119 |
func TestListEmptyConfigList(t *testing.T) {
|
| 120 | 120 |
mockRegistry := test.BuildConfigRegistry{BuildConfigs: &api.BuildConfigList{JSONBase: kubeapi.JSONBase{ResourceVersion: 1}}}
|
| 121 | 121 |
storage := REST{&mockRegistry}
|
| 122 |
- buildConfigs, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 122 |
+ buildConfigs, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 123 | 123 |
if err != nil {
|
| 124 | 124 |
t.Errorf("unexpected error: %v", err)
|
| 125 | 125 |
} |
| ... | ... |
@@ -150,7 +150,7 @@ func TestListConfigs(t *testing.T) {
|
| 150 | 150 |
}, |
| 151 | 151 |
} |
| 152 | 152 |
storage := REST{&mockRegistry}
|
| 153 |
- configsObj, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 153 |
+ configsObj, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 154 | 154 |
configs := configsObj.(*api.BuildConfigList) |
| 155 | 155 |
if err != nil {
|
| 156 | 156 |
t.Errorf("unexpected error: %v", err)
|
| ... | ... |
@@ -232,7 +232,7 @@ func TestCreateBuildConfig(t *testing.T) {
|
| 232 | 232 |
mockRegistry := test.BuildConfigRegistry{}
|
| 233 | 233 |
storage := REST{&mockRegistry}
|
| 234 | 234 |
buildConfig := mockBuildConfig() |
| 235 |
- channel, err := storage.Create(buildConfig) |
|
| 235 |
+ channel, err := storage.Create(nil, buildConfig) |
|
| 236 | 236 |
if err != nil {
|
| 237 | 237 |
t.Fatalf("Unexpected error: %v", err)
|
| 238 | 238 |
} |
| ... | ... |
@@ -268,7 +268,7 @@ func TestUpdateBuildConfig(t *testing.T) {
|
| 268 | 268 |
mockRegistry := test.BuildConfigRegistry{}
|
| 269 | 269 |
storage := REST{&mockRegistry}
|
| 270 | 270 |
buildConfig := mockBuildConfig() |
| 271 |
- channel, err := storage.Update(buildConfig) |
|
| 271 |
+ channel, err := storage.Update(nil, buildConfig) |
|
| 272 | 272 |
if err != nil {
|
| 273 | 273 |
t.Errorf("unexpected error: %v", err)
|
| 274 | 274 |
} |
| ... | ... |
@@ -295,7 +295,7 @@ func TestUpdateBuildConfigError(t *testing.T) {
|
| 295 | 295 |
mockRegistry := test.BuildConfigRegistry{Err: fmt.Errorf("Update error")}
|
| 296 | 296 |
storage := REST{&mockRegistry}
|
| 297 | 297 |
buildConfig := mockBuildConfig() |
| 298 |
- channel, err := storage.Update(buildConfig) |
|
| 298 |
+ channel, err := storage.Update(nil, buildConfig) |
|
| 299 | 299 |
if err != nil {
|
| 300 | 300 |
t.Errorf("unexpected error: %v", err)
|
| 301 | 301 |
} |
| ... | ... |
@@ -346,7 +346,7 @@ func TestBuildConfigRESTValidatesCreate(t *testing.T) {
|
| 346 | 346 |
}, |
| 347 | 347 |
} |
| 348 | 348 |
for desc, failureCase := range failureCases {
|
| 349 |
- c, err := storage.Create(&failureCase) |
|
| 349 |
+ c, err := storage.Create(nil, &failureCase) |
|
| 350 | 350 |
if c != nil {
|
| 351 | 351 |
t.Errorf("%s: Expected nil channel", desc)
|
| 352 | 352 |
} |
| ... | ... |
@@ -405,7 +405,7 @@ func TestBuildRESTValidatesUpdate(t *testing.T) {
|
| 405 | 405 |
}, |
| 406 | 406 |
} |
| 407 | 407 |
for desc, failureCase := range failureCases {
|
| 408 |
- c, err := storage.Update(&failureCase) |
|
| 408 |
+ c, err := storage.Update(nil, &failureCase) |
|
| 409 | 409 |
if c != nil {
|
| 410 | 410 |
t.Errorf("%s: Expected nil channel", desc)
|
| 411 | 411 |
} |
| ... | ... |
@@ -29,13 +29,13 @@ func TestSetupDockerSocketHostSocket(t *testing.T) {
|
| 29 | 29 |
if volume.Source == nil {
|
| 30 | 30 |
t.Fatalf("Unexpected nil volume source")
|
| 31 | 31 |
} |
| 32 |
- if volume.Source.HostDirectory == nil {
|
|
| 32 |
+ if volume.Source.HostDir == nil {
|
|
| 33 | 33 |
t.Fatalf("Unexpected nil host directory")
|
| 34 | 34 |
} |
| 35 |
- if volume.Source.EmptyDirectory != nil {
|
|
| 36 |
- t.Errorf("Unexpected non-nil empty directory: %#v", volume.Source.EmptyDirectory)
|
|
| 35 |
+ if volume.Source.EmptyDir != nil {
|
|
| 36 |
+ t.Errorf("Unexpected non-nil empty directory: %#v", volume.Source.EmptyDir)
|
|
| 37 | 37 |
} |
| 38 |
- if e, a := "/var/run/docker.sock", volume.Source.HostDirectory.Path; e != a {
|
|
| 38 |
+ if e, a := "/var/run/docker.sock", volume.Source.HostDir.Path; e != a {
|
|
| 39 | 39 |
t.Errorf("Expected %s, got %s", e, a)
|
| 40 | 40 |
} |
| 41 | 41 |
|
| ... | ... |
@@ -4,6 +4,7 @@ import ( |
| 4 | 4 |
"io/ioutil" |
| 5 | 5 |
"net/http" |
| 6 | 6 |
"net/http/httptest" |
| 7 |
+ "net/url" |
|
| 7 | 8 |
"testing" |
| 8 | 9 |
|
| 9 | 10 |
kubeapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| ... | ... |
@@ -57,7 +58,8 @@ func TestApplySendsData(t *testing.T) {
|
| 57 | 57 |
} |
| 58 | 58 |
})) |
| 59 | 59 |
|
| 60 |
- fakeClient, _ := kubeclient.NewRESTClient(fakeServer.URL, nil, "/api/v1beta1/", fakeCodec) |
|
| 60 |
+ uri, _ := url.Parse(fakeServer.URL + "/api/v1beta1") |
|
| 61 |
+ fakeClient := kubeclient.NewRESTClient(uri, fakeCodec) |
|
| 61 | 62 |
clients := clientapi.ClientMappings{
|
| 62 | 63 |
"FakeMapping": {"FakeResource", fakeClient, fakeCodec},
|
| 63 | 64 |
} |
| ... | ... |
@@ -72,7 +74,7 @@ func TestApplySendsData(t *testing.T) {
|
| 72 | 72 |
} |
| 73 | 73 |
|
| 74 | 74 |
func TestGetClientAndPath(t *testing.T) {
|
| 75 |
- kubeClient, _ := kubeclient.New("127.0.0.1", "", nil)
|
|
| 75 |
+ kubeClient, _ := kubeclient.New(&kubeclient.Config{Host: "127.0.0.1"})
|
|
| 76 | 76 |
testClientMappings := clientapi.ClientMappings{
|
| 77 | 77 |
"pods": {"Pod", kubeClient.RESTClient, klatest.Codec},
|
| 78 | 78 |
"services": {"Service", kubeClient.RESTClient, klatest.Codec},
|
| ... | ... |
@@ -87,7 +89,7 @@ func TestGetClientAndPath(t *testing.T) {
|
| 87 | 87 |
} |
| 88 | 88 |
|
| 89 | 89 |
func ExampleApply() {
|
| 90 |
- kubeClient, _ := kubeclient.New("127.0.0.1", "", nil)
|
|
| 90 |
+ kubeClient, _ := kubeclient.New(&kubeclient.Config{Host: "127.0.0.1"})
|
|
| 91 | 91 |
testClientMappings := clientapi.ClientMappings{
|
| 92 | 92 |
"pods": {"Pod", kubeClient.RESTClient, klatest.Codec},
|
| 93 | 93 |
"services": {"Service", kubeClient.RESTClient, klatest.Codec},
|
| ... | ... |
@@ -20,7 +20,7 @@ func TestListDeploymentsError(t *testing.T) {
|
| 20 | 20 |
registry: mockRegistry, |
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
- deployments, err := storage.List(nil, nil) |
|
| 23 |
+ deployments, err := storage.List(nil, nil, nil) |
|
| 24 | 24 |
if err != mockRegistry.Err {
|
| 25 | 25 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 26 | 26 |
} |
| ... | ... |
@@ -40,7 +40,7 @@ func TestListDeploymentsEmptyList(t *testing.T) {
|
| 40 | 40 |
registry: mockRegistry, |
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 |
- deployments, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 43 |
+ deployments, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 44 | 44 |
if err != nil {
|
| 45 | 45 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 46 | 46 |
} |
| ... | ... |
@@ -71,7 +71,7 @@ func TestListDeploymentsPopulatedList(t *testing.T) {
|
| 71 | 71 |
registry: mockRegistry, |
| 72 | 72 |
} |
| 73 | 73 |
|
| 74 |
- list, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 74 |
+ list, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 75 | 75 |
if err != nil {
|
| 76 | 76 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 77 | 77 |
} |
| ... | ... |
@@ -86,7 +86,7 @@ func TestListDeploymentsPopulatedList(t *testing.T) {
|
| 86 | 86 |
func TestCreateDeploymentBadObject(t *testing.T) {
|
| 87 | 87 |
storage := REST{}
|
| 88 | 88 |
|
| 89 |
- channel, err := storage.Create(&api.DeploymentList{})
|
|
| 89 |
+ channel, err := storage.Create(nil, &api.DeploymentList{})
|
|
| 90 | 90 |
if channel != nil {
|
| 91 | 91 |
t.Errorf("Expected nil, got %v", channel)
|
| 92 | 92 |
} |
| ... | ... |
@@ -113,7 +113,7 @@ func TestCreateRegistrySaveError(t *testing.T) {
|
| 113 | 113 |
mockRegistry.Err = fmt.Errorf("test error")
|
| 114 | 114 |
storage := REST{registry: mockRegistry}
|
| 115 | 115 |
|
| 116 |
- channel, err := storage.Create(&api.Deployment{
|
|
| 116 |
+ channel, err := storage.Create(nil, &api.Deployment{
|
|
| 117 | 117 |
JSONBase: kubeapi.JSONBase{ID: "foo"},
|
| 118 | 118 |
Strategy: okStrategy(), |
| 119 | 119 |
}) |
| ... | ... |
@@ -130,7 +130,7 @@ func TestCreateRegistrySaveError(t *testing.T) {
|
| 130 | 130 |
if !ok {
|
| 131 | 131 |
t.Errorf("Expected status type, got: %#v", result)
|
| 132 | 132 |
} |
| 133 |
- if status.Status != "failure" || status.Message != "foo" {
|
|
| 133 |
+ if status.Status != kubeapi.StatusFailure || status.Message != "foo" {
|
|
| 134 | 134 |
t.Errorf("Expected failure status, got %#V", status)
|
| 135 | 135 |
} |
| 136 | 136 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -143,7 +143,7 @@ func TestCreateDeploymentOK(t *testing.T) {
|
| 143 | 143 |
mockRegistry := test.NewDeploymentRegistry() |
| 144 | 144 |
storage := REST{registry: mockRegistry}
|
| 145 | 145 |
|
| 146 |
- channel, err := storage.Create(&api.Deployment{
|
|
| 146 |
+ channel, err := storage.Create(nil, &api.Deployment{
|
|
| 147 | 147 |
JSONBase: kubeapi.JSONBase{ID: "foo"},
|
| 148 | 148 |
Strategy: okStrategy(), |
| 149 | 149 |
}) |
| ... | ... |
@@ -174,7 +174,7 @@ func TestGetDeploymentError(t *testing.T) {
|
| 174 | 174 |
mockRegistry.Err = fmt.Errorf("bad")
|
| 175 | 175 |
storage := REST{registry: mockRegistry}
|
| 176 | 176 |
|
| 177 |
- deployment, err := storage.Get("foo")
|
|
| 177 |
+ deployment, err := storage.Get(nil, "foo") |
|
| 178 | 178 |
if deployment != nil {
|
| 179 | 179 |
t.Errorf("Unexpected non-nil deployment: %#v", deployment)
|
| 180 | 180 |
} |
| ... | ... |
@@ -190,7 +190,7 @@ func TestGetDeploymentOK(t *testing.T) {
|
| 190 | 190 |
} |
| 191 | 191 |
storage := REST{registry: mockRegistry}
|
| 192 | 192 |
|
| 193 |
- deployment, err := storage.Get("foo")
|
|
| 193 |
+ deployment, err := storage.Get(nil, "foo") |
|
| 194 | 194 |
if deployment == nil {
|
| 195 | 195 |
t.Error("Unexpected nil deployment")
|
| 196 | 196 |
} |
| ... | ... |
@@ -205,7 +205,7 @@ func TestGetDeploymentOK(t *testing.T) {
|
| 205 | 205 |
func TestUpdateDeploymentBadObject(t *testing.T) {
|
| 206 | 206 |
storage := REST{}
|
| 207 | 207 |
|
| 208 |
- channel, err := storage.Update(&api.DeploymentConfig{})
|
|
| 208 |
+ channel, err := storage.Update(nil, &api.DeploymentConfig{})
|
|
| 209 | 209 |
if channel != nil {
|
| 210 | 210 |
t.Errorf("Expected nil, got %v", channel)
|
| 211 | 211 |
} |
| ... | ... |
@@ -217,7 +217,7 @@ func TestUpdateDeploymentBadObject(t *testing.T) {
|
| 217 | 217 |
func TestUpdateDeploymentMissingID(t *testing.T) {
|
| 218 | 218 |
storage := REST{}
|
| 219 | 219 |
|
| 220 |
- channel, err := storage.Update(&api.Deployment{})
|
|
| 220 |
+ channel, err := storage.Update(nil, &api.Deployment{})
|
|
| 221 | 221 |
if channel != nil {
|
| 222 | 222 |
t.Errorf("Expected nil, got %v", channel)
|
| 223 | 223 |
} |
| ... | ... |
@@ -231,7 +231,7 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 231 | 231 |
mockRepositoryRegistry.Err = fmt.Errorf("foo")
|
| 232 | 232 |
storage := REST{registry: mockRepositoryRegistry}
|
| 233 | 233 |
|
| 234 |
- channel, err := storage.Update(&api.Deployment{
|
|
| 234 |
+ channel, err := storage.Update(nil, &api.Deployment{
|
|
| 235 | 235 |
JSONBase: kubeapi.JSONBase{ID: "bar"},
|
| 236 | 236 |
}) |
| 237 | 237 |
if err != nil {
|
| ... | ... |
@@ -242,7 +242,7 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 242 | 242 |
if !ok {
|
| 243 | 243 |
t.Errorf("Expected status, got %#v", result)
|
| 244 | 244 |
} |
| 245 |
- if status.Status != "failure" || status.Message != "foo" {
|
|
| 245 |
+ if status.Status != kubeapi.StatusFailure || status.Message != "foo" {
|
|
| 246 | 246 |
t.Errorf("Expected status=failure, message=foo, got %#v", status)
|
| 247 | 247 |
} |
| 248 | 248 |
} |
| ... | ... |
@@ -251,7 +251,7 @@ func TestUpdateDeploymentOK(t *testing.T) {
|
| 251 | 251 |
mockRepositoryRegistry := test.NewDeploymentRegistry() |
| 252 | 252 |
storage := REST{registry: mockRepositoryRegistry}
|
| 253 | 253 |
|
| 254 |
- channel, err := storage.Update(&api.Deployment{
|
|
| 254 |
+ channel, err := storage.Update(nil, &api.Deployment{
|
|
| 255 | 255 |
JSONBase: kubeapi.JSONBase{ID: "bar"},
|
| 256 | 256 |
}) |
| 257 | 257 |
if err != nil {
|
| ... | ... |
@@ -270,7 +270,7 @@ func TestUpdateDeploymentOK(t *testing.T) {
|
| 270 | 270 |
func TestDeleteDeployment(t *testing.T) {
|
| 271 | 271 |
mockRegistry := test.NewDeploymentRegistry() |
| 272 | 272 |
storage := REST{registry: mockRegistry}
|
| 273 |
- channel, err := storage.Delete("foo")
|
|
| 273 |
+ channel, err := storage.Delete(nil, "foo") |
|
| 274 | 274 |
if channel == nil {
|
| 275 | 275 |
t.Error("Unexpected nil channel")
|
| 276 | 276 |
} |
| ... | ... |
@@ -284,7 +284,7 @@ func TestDeleteDeployment(t *testing.T) {
|
| 284 | 284 |
if !ok {
|
| 285 | 285 |
t.Errorf("Expected status type, got: %#v", result)
|
| 286 | 286 |
} |
| 287 |
- if status.Status != "success" {
|
|
| 287 |
+ if status.Status != kubeapi.StatusSuccess {
|
|
| 288 | 288 |
t.Errorf("Expected status=success, got: %#v", status)
|
| 289 | 289 |
} |
| 290 | 290 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -20,7 +20,7 @@ func TestListDeploymentConfigsError(t *testing.T) {
|
| 20 | 20 |
registry: mockRegistry, |
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
- deploymentConfigs, err := storage.List(nil, nil) |
|
| 23 |
+ deploymentConfigs, err := storage.List(nil, nil, nil) |
|
| 24 | 24 |
if err != mockRegistry.Err {
|
| 25 | 25 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 26 | 26 |
} |
| ... | ... |
@@ -40,7 +40,7 @@ func TestListDeploymentConfigsEmptyList(t *testing.T) {
|
| 40 | 40 |
registry: mockRegistry, |
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 |
- deploymentConfigs, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 43 |
+ deploymentConfigs, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 44 | 44 |
if err != nil {
|
| 45 | 45 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 46 | 46 |
} |
| ... | ... |
@@ -71,7 +71,7 @@ func TestListDeploymentConfigsPopulatedList(t *testing.T) {
|
| 71 | 71 |
registry: mockRegistry, |
| 72 | 72 |
} |
| 73 | 73 |
|
| 74 |
- list, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 74 |
+ list, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 75 | 75 |
if err != nil {
|
| 76 | 76 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 77 | 77 |
} |
| ... | ... |
@@ -86,7 +86,7 @@ func TestListDeploymentConfigsPopulatedList(t *testing.T) {
|
| 86 | 86 |
func TestCreateDeploymentConfigBadObject(t *testing.T) {
|
| 87 | 87 |
storage := REST{}
|
| 88 | 88 |
|
| 89 |
- channel, err := storage.Create(&api.DeploymentList{})
|
|
| 89 |
+ channel, err := storage.Create(nil, &api.DeploymentList{})
|
|
| 90 | 90 |
if channel != nil {
|
| 91 | 91 |
t.Errorf("Expected nil, got %v", channel)
|
| 92 | 92 |
} |
| ... | ... |
@@ -100,7 +100,7 @@ func TestCreateRegistrySaveError(t *testing.T) {
|
| 100 | 100 |
mockRegistry.Err = fmt.Errorf("test error")
|
| 101 | 101 |
storage := REST{registry: mockRegistry}
|
| 102 | 102 |
|
| 103 |
- channel, err := storage.Create(&api.DeploymentConfig{
|
|
| 103 |
+ channel, err := storage.Create(nil, &api.DeploymentConfig{
|
|
| 104 | 104 |
JSONBase: kubeapi.JSONBase{ID: "foo"},
|
| 105 | 105 |
}) |
| 106 | 106 |
if channel == nil {
|
| ... | ... |
@@ -116,7 +116,7 @@ func TestCreateRegistrySaveError(t *testing.T) {
|
| 116 | 116 |
if !ok {
|
| 117 | 117 |
t.Errorf("Expected status type, got: %#v", result)
|
| 118 | 118 |
} |
| 119 |
- if status.Status != "failure" || status.Message != "foo" {
|
|
| 119 |
+ if status.Status != kubeapi.StatusFailure || status.Message != "foo" {
|
|
| 120 | 120 |
t.Errorf("Expected failure status, got %#V", status)
|
| 121 | 121 |
} |
| 122 | 122 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -129,7 +129,7 @@ func TestCreateDeploymentConfigOK(t *testing.T) {
|
| 129 | 129 |
mockRegistry := test.NewDeploymentConfigRegistry() |
| 130 | 130 |
storage := REST{registry: mockRegistry}
|
| 131 | 131 |
|
| 132 |
- channel, err := storage.Create(&api.DeploymentConfig{
|
|
| 132 |
+ channel, err := storage.Create(nil, &api.DeploymentConfig{
|
|
| 133 | 133 |
JSONBase: kubeapi.JSONBase{ID: "foo"},
|
| 134 | 134 |
}) |
| 135 | 135 |
if channel == nil {
|
| ... | ... |
@@ -159,7 +159,7 @@ func TestGetDeploymentConfigError(t *testing.T) {
|
| 159 | 159 |
mockRegistry.Err = fmt.Errorf("bad")
|
| 160 | 160 |
storage := REST{registry: mockRegistry}
|
| 161 | 161 |
|
| 162 |
- deploymentConfig, err := storage.Get("foo")
|
|
| 162 |
+ deploymentConfig, err := storage.Get(nil, "foo") |
|
| 163 | 163 |
if deploymentConfig != nil {
|
| 164 | 164 |
t.Errorf("Unexpected non-nil deploymentConfig: %#v", deploymentConfig)
|
| 165 | 165 |
} |
| ... | ... |
@@ -175,7 +175,7 @@ func TestGetDeploymentConfigOK(t *testing.T) {
|
| 175 | 175 |
} |
| 176 | 176 |
storage := REST{registry: mockRegistry}
|
| 177 | 177 |
|
| 178 |
- deploymentConfig, err := storage.Get("foo")
|
|
| 178 |
+ deploymentConfig, err := storage.Get(nil, "foo") |
|
| 179 | 179 |
if deploymentConfig == nil {
|
| 180 | 180 |
t.Error("Unexpected nil deploymentConfig")
|
| 181 | 181 |
} |
| ... | ... |
@@ -190,7 +190,7 @@ func TestGetDeploymentConfigOK(t *testing.T) {
|
| 190 | 190 |
func TestUpdateDeploymentConfigBadObject(t *testing.T) {
|
| 191 | 191 |
storage := REST{}
|
| 192 | 192 |
|
| 193 |
- channel, err := storage.Update(&api.DeploymentList{})
|
|
| 193 |
+ channel, err := storage.Update(nil, &api.DeploymentList{})
|
|
| 194 | 194 |
if channel != nil {
|
| 195 | 195 |
t.Errorf("Expected nil, got %v", channel)
|
| 196 | 196 |
} |
| ... | ... |
@@ -202,7 +202,7 @@ func TestUpdateDeploymentConfigBadObject(t *testing.T) {
|
| 202 | 202 |
func TestUpdateDeploymentConfigMissingID(t *testing.T) {
|
| 203 | 203 |
storage := REST{}
|
| 204 | 204 |
|
| 205 |
- channel, err := storage.Update(&api.DeploymentConfig{})
|
|
| 205 |
+ channel, err := storage.Update(nil, &api.DeploymentConfig{})
|
|
| 206 | 206 |
if channel != nil {
|
| 207 | 207 |
t.Errorf("Expected nil, got %v", channel)
|
| 208 | 208 |
} |
| ... | ... |
@@ -216,7 +216,7 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 216 | 216 |
mockRepositoryRegistry.Err = fmt.Errorf("foo")
|
| 217 | 217 |
storage := REST{registry: mockRepositoryRegistry}
|
| 218 | 218 |
|
| 219 |
- channel, err := storage.Update(&api.DeploymentConfig{
|
|
| 219 |
+ channel, err := storage.Update(nil, &api.DeploymentConfig{
|
|
| 220 | 220 |
JSONBase: kubeapi.JSONBase{ID: "bar"},
|
| 221 | 221 |
}) |
| 222 | 222 |
if err != nil {
|
| ... | ... |
@@ -227,7 +227,7 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 227 | 227 |
if !ok {
|
| 228 | 228 |
t.Errorf("Expected status, got %#v", result)
|
| 229 | 229 |
} |
| 230 |
- if status.Status != "failure" || status.Message != "foo" {
|
|
| 230 |
+ if status.Status != kubeapi.StatusFailure || status.Message != "foo" {
|
|
| 231 | 231 |
t.Errorf("Expected status=failure, message=foo, got %#v", status)
|
| 232 | 232 |
} |
| 233 | 233 |
} |
| ... | ... |
@@ -236,7 +236,7 @@ func TestUpdateDeploymentConfigOK(t *testing.T) {
|
| 236 | 236 |
mockRepositoryRegistry := test.NewDeploymentConfigRegistry() |
| 237 | 237 |
storage := REST{registry: mockRepositoryRegistry}
|
| 238 | 238 |
|
| 239 |
- channel, err := storage.Update(&api.DeploymentConfig{
|
|
| 239 |
+ channel, err := storage.Update(nil, &api.DeploymentConfig{
|
|
| 240 | 240 |
JSONBase: kubeapi.JSONBase{ID: "bar"},
|
| 241 | 241 |
}) |
| 242 | 242 |
if err != nil {
|
| ... | ... |
@@ -255,7 +255,7 @@ func TestUpdateDeploymentConfigOK(t *testing.T) {
|
| 255 | 255 |
func TestDeleteDeploymentConfig(t *testing.T) {
|
| 256 | 256 |
mockRegistry := test.NewDeploymentConfigRegistry() |
| 257 | 257 |
storage := REST{registry: mockRegistry}
|
| 258 |
- channel, err := storage.Delete("foo")
|
|
| 258 |
+ channel, err := storage.Delete(nil, "foo") |
|
| 259 | 259 |
if channel == nil {
|
| 260 | 260 |
t.Error("Unexpected nil channel")
|
| 261 | 261 |
} |
| ... | ... |
@@ -269,7 +269,7 @@ func TestDeleteDeploymentConfig(t *testing.T) {
|
| 269 | 269 |
if !ok {
|
| 270 | 270 |
t.Errorf("Expected status type, got: %#v", result)
|
| 271 | 271 |
} |
| 272 |
- if status.Status != "success" {
|
|
| 272 |
+ if status.Status != kubeapi.StatusSuccess {
|
|
| 273 | 273 |
t.Errorf("Expected status=success, got: %#v", status)
|
| 274 | 274 |
} |
| 275 | 275 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -21,7 +21,7 @@ func TestListImagesError(t *testing.T) {
|
| 21 | 21 |
registry: mockRegistry, |
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 |
- images, err := storage.List(nil, nil) |
|
| 24 |
+ images, err := storage.List(nil, nil, nil) |
|
| 25 | 25 |
if err != mockRegistry.Err {
|
| 26 | 26 |
t.Errorf("Expected %#v, Got %#v", mockRegistry.Err, err)
|
| 27 | 27 |
} |
| ... | ... |
@@ -41,7 +41,7 @@ func TestListImagesEmptyList(t *testing.T) {
|
| 41 | 41 |
registry: mockRegistry, |
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 |
- images, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 44 |
+ images, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 45 | 45 |
if err != nil {
|
| 46 | 46 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 47 | 47 |
} |
| ... | ... |
@@ -72,7 +72,7 @@ func TestListImagesPopulatedList(t *testing.T) {
|
| 72 | 72 |
registry: mockRegistry, |
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 |
- list, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 75 |
+ list, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 76 | 76 |
if err != nil {
|
| 77 | 77 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 78 | 78 |
} |
| ... | ... |
@@ -87,7 +87,7 @@ func TestListImagesPopulatedList(t *testing.T) {
|
| 87 | 87 |
func TestCreateImageBadObject(t *testing.T) {
|
| 88 | 88 |
storage := REST{}
|
| 89 | 89 |
|
| 90 |
- channel, err := storage.Create(&api.ImageList{})
|
|
| 90 |
+ channel, err := storage.Create(nil, &api.ImageList{})
|
|
| 91 | 91 |
if channel != nil {
|
| 92 | 92 |
t.Errorf("Expected nil, got %v", channel)
|
| 93 | 93 |
} |
| ... | ... |
@@ -99,7 +99,7 @@ func TestCreateImageBadObject(t *testing.T) {
|
| 99 | 99 |
func TestCreateImageMissingID(t *testing.T) {
|
| 100 | 100 |
storage := REST{}
|
| 101 | 101 |
|
| 102 |
- channel, err := storage.Create(&api.Image{})
|
|
| 102 |
+ channel, err := storage.Create(nil, &api.Image{})
|
|
| 103 | 103 |
if channel != nil {
|
| 104 | 104 |
t.Errorf("Expected nil channel, got %v", channel)
|
| 105 | 105 |
} |
| ... | ... |
@@ -113,7 +113,7 @@ func TestCreateRegistrySaveError(t *testing.T) {
|
| 113 | 113 |
mockRegistry.Err = fmt.Errorf("test error")
|
| 114 | 114 |
storage := REST{registry: mockRegistry}
|
| 115 | 115 |
|
| 116 |
- channel, err := storage.Create(&api.Image{
|
|
| 116 |
+ channel, err := storage.Create(nil, &api.Image{
|
|
| 117 | 117 |
JSONBase: kubeapi.JSONBase{ID: "foo"},
|
| 118 | 118 |
DockerImageReference: "openshift/ruby-19-centos", |
| 119 | 119 |
}) |
| ... | ... |
@@ -130,7 +130,7 @@ func TestCreateRegistrySaveError(t *testing.T) {
|
| 130 | 130 |
if !ok {
|
| 131 | 131 |
t.Errorf("Expected status type, got: %#v", result)
|
| 132 | 132 |
} |
| 133 |
- if status.Status != "failure" || status.Message != "foo" {
|
|
| 133 |
+ if status.Status != kubeapi.StatusFailure || status.Message != "foo" {
|
|
| 134 | 134 |
t.Errorf("Expected failure status, got %#V", status)
|
| 135 | 135 |
} |
| 136 | 136 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -143,7 +143,7 @@ func TestCreateImageOK(t *testing.T) {
|
| 143 | 143 |
mockRegistry := test.NewImageRegistry() |
| 144 | 144 |
storage := REST{registry: mockRegistry}
|
| 145 | 145 |
|
| 146 |
- channel, err := storage.Create(&api.Image{
|
|
| 146 |
+ channel, err := storage.Create(nil, &api.Image{
|
|
| 147 | 147 |
JSONBase: kubeapi.JSONBase{ID: "foo"},
|
| 148 | 148 |
DockerImageReference: "openshift/ruby-19-centos", |
| 149 | 149 |
}) |
| ... | ... |
@@ -174,7 +174,7 @@ func TestGetImageError(t *testing.T) {
|
| 174 | 174 |
mockRegistry.Err = fmt.Errorf("bad")
|
| 175 | 175 |
storage := REST{registry: mockRegistry}
|
| 176 | 176 |
|
| 177 |
- image, err := storage.Get("foo")
|
|
| 177 |
+ image, err := storage.Get(nil, "foo") |
|
| 178 | 178 |
if image != nil {
|
| 179 | 179 |
t.Errorf("Unexpected non-nil image: %#v", image)
|
| 180 | 180 |
} |
| ... | ... |
@@ -191,7 +191,7 @@ func TestGetImageOK(t *testing.T) {
|
| 191 | 191 |
} |
| 192 | 192 |
storage := REST{registry: mockRegistry}
|
| 193 | 193 |
|
| 194 |
- image, err := storage.Get("foo")
|
|
| 194 |
+ image, err := storage.Get(nil, "foo") |
|
| 195 | 195 |
if image == nil {
|
| 196 | 196 |
t.Error("Unexpected nil image")
|
| 197 | 197 |
} |
| ... | ... |
@@ -205,7 +205,7 @@ func TestGetImageOK(t *testing.T) {
|
| 205 | 205 |
|
| 206 | 206 |
func TestUpdateImage(t *testing.T) {
|
| 207 | 207 |
storage := REST{}
|
| 208 |
- channel, err := storage.Update(&api.Image{})
|
|
| 208 |
+ channel, err := storage.Update(nil, &api.Image{})
|
|
| 209 | 209 |
if channel != nil {
|
| 210 | 210 |
t.Errorf("Unexpected non-nil channel: %#v", channel)
|
| 211 | 211 |
} |
| ... | ... |
@@ -220,7 +220,7 @@ func TestUpdateImage(t *testing.T) {
|
| 220 | 220 |
func TestDeleteImage(t *testing.T) {
|
| 221 | 221 |
mockRegistry := test.NewImageRegistry() |
| 222 | 222 |
storage := REST{registry: mockRegistry}
|
| 223 |
- channel, err := storage.Delete("foo")
|
|
| 223 |
+ channel, err := storage.Delete(nil, "foo") |
|
| 224 | 224 |
if channel == nil {
|
| 225 | 225 |
t.Error("Unexpected nil channel")
|
| 226 | 226 |
} |
| ... | ... |
@@ -234,7 +234,7 @@ func TestDeleteImage(t *testing.T) {
|
| 234 | 234 |
if !ok {
|
| 235 | 235 |
t.Errorf("Expected status type, got: %#v", result)
|
| 236 | 236 |
} |
| 237 |
- if status.Status != "success" {
|
|
| 237 |
+ if status.Status != kubeapi.StatusSuccess {
|
|
| 238 | 238 |
t.Errorf("Expected status=success, got: %#v", status)
|
| 239 | 239 |
} |
| 240 | 240 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -17,7 +17,7 @@ func TestGetImageRepositoryError(t *testing.T) {
|
| 17 | 17 |
mockRepositoryRegistry.Err = fmt.Errorf("test error")
|
| 18 | 18 |
storage := REST{registry: mockRepositoryRegistry}
|
| 19 | 19 |
|
| 20 |
- image, err := storage.Get("image1")
|
|
| 20 |
+ image, err := storage.Get(nil, "image1") |
|
| 21 | 21 |
if image != nil {
|
| 22 | 22 |
t.Errorf("Unexpected non-nil image: %#v", image)
|
| 23 | 23 |
} |
| ... | ... |
@@ -34,7 +34,7 @@ func TestGetImageRepositoryOK(t *testing.T) {
|
| 34 | 34 |
} |
| 35 | 35 |
storage := REST{registry: mockRepositoryRegistry}
|
| 36 | 36 |
|
| 37 |
- repo, err := storage.Get("foo")
|
|
| 37 |
+ repo, err := storage.Get(nil, "foo") |
|
| 38 | 38 |
if repo == nil {
|
| 39 | 39 |
t.Errorf("Unexpected nil repo: %#v", repo)
|
| 40 | 40 |
} |
| ... | ... |
@@ -54,7 +54,7 @@ func TestListImageRepositoriesError(t *testing.T) {
|
| 54 | 54 |
registry: mockRepositoryRegistry, |
| 55 | 55 |
} |
| 56 | 56 |
|
| 57 |
- imageRepositories, err := storage.List(nil, nil) |
|
| 57 |
+ imageRepositories, err := storage.List(nil, nil, nil) |
|
| 58 | 58 |
if err != mockRepositoryRegistry.Err {
|
| 59 | 59 |
t.Errorf("Expected %#v, Got %#v", mockRepositoryRegistry.Err, err)
|
| 60 | 60 |
} |
| ... | ... |
@@ -74,7 +74,7 @@ func TestListImageRepositoriesEmptyList(t *testing.T) {
|
| 74 | 74 |
registry: mockRepositoryRegistry, |
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 |
- imageRepositories, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 77 |
+ imageRepositories, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 78 | 78 |
if err != nil {
|
| 79 | 79 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 80 | 80 |
} |
| ... | ... |
@@ -105,7 +105,7 @@ func TestListImageRepositoriesPopulatedList(t *testing.T) {
|
| 105 | 105 |
registry: mockRepositoryRegistry, |
| 106 | 106 |
} |
| 107 | 107 |
|
| 108 |
- list, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 108 |
+ list, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 109 | 109 |
if err != nil {
|
| 110 | 110 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 111 | 111 |
} |
| ... | ... |
@@ -120,7 +120,7 @@ func TestListImageRepositoriesPopulatedList(t *testing.T) {
|
| 120 | 120 |
func TestCreateImageRepositoryBadObject(t *testing.T) {
|
| 121 | 121 |
storage := REST{}
|
| 122 | 122 |
|
| 123 |
- channel, err := storage.Create(&api.ImageList{})
|
|
| 123 |
+ channel, err := storage.Create(nil, &api.ImageList{})
|
|
| 124 | 124 |
if channel != nil {
|
| 125 | 125 |
t.Errorf("Expected nil, got %v", channel)
|
| 126 | 126 |
} |
| ... | ... |
@@ -133,7 +133,7 @@ func TestCreateImageRepositoryOK(t *testing.T) {
|
| 133 | 133 |
mockRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 134 | 134 |
storage := REST{registry: mockRepositoryRegistry}
|
| 135 | 135 |
|
| 136 |
- channel, err := storage.Create(&api.ImageRepository{})
|
|
| 136 |
+ channel, err := storage.Create(nil, &api.ImageRepository{})
|
|
| 137 | 137 |
if err != nil {
|
| 138 | 138 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 139 | 139 |
} |
| ... | ... |
@@ -156,7 +156,7 @@ func TestCreateRegistryErrorSaving(t *testing.T) {
|
| 156 | 156 |
mockRepositoryRegistry.Err = fmt.Errorf("foo")
|
| 157 | 157 |
storage := REST{registry: mockRepositoryRegistry}
|
| 158 | 158 |
|
| 159 |
- channel, err := storage.Create(&api.ImageRepository{})
|
|
| 159 |
+ channel, err := storage.Create(nil, &api.ImageRepository{})
|
|
| 160 | 160 |
if err != nil {
|
| 161 | 161 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 162 | 162 |
} |
| ... | ... |
@@ -165,7 +165,7 @@ func TestCreateRegistryErrorSaving(t *testing.T) {
|
| 165 | 165 |
if !ok {
|
| 166 | 166 |
t.Errorf("Expected status, got %#v", result)
|
| 167 | 167 |
} |
| 168 |
- if status.Status != "failure" || status.Message != "foo" {
|
|
| 168 |
+ if status.Status != kubeapi.StatusFailure || status.Message != "foo" {
|
|
| 169 | 169 |
t.Errorf("Expected status=failure, message=foo, got %#v", status)
|
| 170 | 170 |
} |
| 171 | 171 |
} |
| ... | ... |
@@ -173,7 +173,7 @@ func TestCreateRegistryErrorSaving(t *testing.T) {
|
| 173 | 173 |
func TestUpdateImageRepositoryBadObject(t *testing.T) {
|
| 174 | 174 |
storage := REST{}
|
| 175 | 175 |
|
| 176 |
- channel, err := storage.Update(&api.ImageList{})
|
|
| 176 |
+ channel, err := storage.Update(nil, &api.ImageList{})
|
|
| 177 | 177 |
if channel != nil {
|
| 178 | 178 |
t.Errorf("Expected nil, got %v", channel)
|
| 179 | 179 |
} |
| ... | ... |
@@ -185,7 +185,7 @@ func TestUpdateImageRepositoryBadObject(t *testing.T) {
|
| 185 | 185 |
func TestUpdateImageRepositoryMissingID(t *testing.T) {
|
| 186 | 186 |
storage := REST{}
|
| 187 | 187 |
|
| 188 |
- channel, err := storage.Update(&api.ImageRepository{})
|
|
| 188 |
+ channel, err := storage.Update(nil, &api.ImageRepository{})
|
|
| 189 | 189 |
if channel != nil {
|
| 190 | 190 |
t.Errorf("Expected nil, got %v", channel)
|
| 191 | 191 |
} |
| ... | ... |
@@ -199,7 +199,7 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 199 | 199 |
mockRepositoryRegistry.Err = fmt.Errorf("foo")
|
| 200 | 200 |
storage := REST{registry: mockRepositoryRegistry}
|
| 201 | 201 |
|
| 202 |
- channel, err := storage.Update(&api.ImageRepository{
|
|
| 202 |
+ channel, err := storage.Update(nil, &api.ImageRepository{
|
|
| 203 | 203 |
JSONBase: kubeapi.JSONBase{ID: "bar"},
|
| 204 | 204 |
}) |
| 205 | 205 |
if err != nil {
|
| ... | ... |
@@ -210,7 +210,7 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 210 | 210 |
if !ok {
|
| 211 | 211 |
t.Errorf("Expected status, got %#v", result)
|
| 212 | 212 |
} |
| 213 |
- if status.Status != "failure" || status.Message != "foo" {
|
|
| 213 |
+ if status.Status != kubeapi.StatusFailure || status.Message != "foo" {
|
|
| 214 | 214 |
t.Errorf("Expected status=failure, message=foo, got %#v", status)
|
| 215 | 215 |
} |
| 216 | 216 |
} |
| ... | ... |
@@ -219,7 +219,7 @@ func TestUpdateImageRepositoryOK(t *testing.T) {
|
| 219 | 219 |
mockRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 220 | 220 |
storage := REST{registry: mockRepositoryRegistry}
|
| 221 | 221 |
|
| 222 |
- channel, err := storage.Update(&api.ImageRepository{
|
|
| 222 |
+ channel, err := storage.Update(nil, &api.ImageRepository{
|
|
| 223 | 223 |
JSONBase: kubeapi.JSONBase{ID: "bar"},
|
| 224 | 224 |
}) |
| 225 | 225 |
if err != nil {
|
| ... | ... |
@@ -239,7 +239,7 @@ func TestDeleteImageRepository(t *testing.T) {
|
| 239 | 239 |
mockRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 240 | 240 |
storage := REST{registry: mockRepositoryRegistry}
|
| 241 | 241 |
|
| 242 |
- channel, err := storage.Delete("foo")
|
|
| 242 |
+ channel, err := storage.Delete(nil, "foo") |
|
| 243 | 243 |
if err != nil {
|
| 244 | 244 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 245 | 245 |
} |
| ... | ... |
@@ -248,7 +248,7 @@ func TestDeleteImageRepository(t *testing.T) {
|
| 248 | 248 |
if !ok {
|
| 249 | 249 |
t.Errorf("Expected status, got %#v", result)
|
| 250 | 250 |
} |
| 251 |
- if status.Status != "success" {
|
|
| 251 |
+ if status.Status != kubeapi.StatusSuccess {
|
|
| 252 | 252 |
t.Errorf("Expected status=success, got %#v", status)
|
| 253 | 253 |
} |
| 254 | 254 |
} |
| ... | ... |
@@ -20,7 +20,7 @@ func TestGetImageRepositoryMapping(t *testing.T) {
|
| 20 | 20 |
imageRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 21 | 21 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 22 | 22 |
|
| 23 |
- obj, err := storage.Get("foo")
|
|
| 23 |
+ obj, err := storage.Get(nil, "foo") |
|
| 24 | 24 |
if obj != nil {
|
| 25 | 25 |
t.Errorf("Unexpected non-nil object %#v", obj)
|
| 26 | 26 |
} |
| ... | ... |
@@ -37,7 +37,7 @@ func TestListImageRepositoryMappings(t *testing.T) {
|
| 37 | 37 |
imageRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 38 | 38 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 39 | 39 |
|
| 40 |
- list, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 40 |
+ list, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 41 | 41 |
if list != nil {
|
| 42 | 42 |
t.Errorf("Unexpected non-nil list %#v", list)
|
| 43 | 43 |
} |
| ... | ... |
@@ -54,7 +54,7 @@ func TestDeleteImageRepositoryMapping(t *testing.T) {
|
| 54 | 54 |
imageRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 55 | 55 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 56 | 56 |
|
| 57 |
- channel, err := storage.Delete("repo1")
|
|
| 57 |
+ channel, err := storage.Delete(nil, "repo1") |
|
| 58 | 58 |
if channel != nil {
|
| 59 | 59 |
t.Errorf("Unexpected non-nil channel %#v", channel)
|
| 60 | 60 |
} |
| ... | ... |
@@ -71,7 +71,7 @@ func TestUpdateImageRepositoryMapping(t *testing.T) {
|
| 71 | 71 |
imageRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 72 | 72 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 73 | 73 |
|
| 74 |
- channel, err := storage.Update(&api.ImageList{})
|
|
| 74 |
+ channel, err := storage.Update(nil, &api.ImageList{})
|
|
| 75 | 75 |
if channel != nil {
|
| 76 | 76 |
t.Errorf("Unexpected non-nil channel %#v", channel)
|
| 77 | 77 |
} |
| ... | ... |
@@ -88,7 +88,7 @@ func TestCreateImageRepositoryMappingBadObject(t *testing.T) {
|
| 88 | 88 |
imageRepositoryRegistry := test.NewImageRepositoryRegistry() |
| 89 | 89 |
storage := &REST{imageRegistry, imageRepositoryRegistry}
|
| 90 | 90 |
|
| 91 |
- channel, err := storage.Create(&api.ImageList{})
|
|
| 91 |
+ channel, err := storage.Create(nil, &api.ImageList{})
|
|
| 92 | 92 |
if channel != nil {
|
| 93 | 93 |
t.Errorf("Unexpected non-nil channel %#v", channel)
|
| 94 | 94 |
} |
| ... | ... |
@@ -117,7 +117,7 @@ func TestCreateImageRepositoryMappingFindError(t *testing.T) {
|
| 117 | 117 |
Tag: "latest", |
| 118 | 118 |
} |
| 119 | 119 |
|
| 120 |
- channel, err := storage.Create(&mapping) |
|
| 120 |
+ channel, err := storage.Create(nil, &mapping) |
|
| 121 | 121 |
if channel != nil {
|
| 122 | 122 |
t.Errorf("Unexpected non-nil channel %#v", channel)
|
| 123 | 123 |
} |
| ... | ... |
@@ -155,7 +155,7 @@ func TestCreateImageRepositoryMappingNotFound(t *testing.T) {
|
| 155 | 155 |
Tag: "latest", |
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 |
- channel, err := storage.Create(&mapping) |
|
| 158 |
+ channel, err := storage.Create(nil, &mapping) |
|
| 159 | 159 |
if channel != nil {
|
| 160 | 160 |
t.Errorf("Unexpected non-nil channel %#v", channel)
|
| 161 | 161 |
} |
| ... | ... |
@@ -202,7 +202,7 @@ func TestCreateImageRepositoryMapping(t *testing.T) {
|
| 202 | 202 |
}, |
| 203 | 203 |
Tag: "latest", |
| 204 | 204 |
} |
| 205 |
- ch, err := storage.Create(&mapping) |
|
| 205 |
+ ch, err := storage.Create(nil, &mapping) |
|
| 206 | 206 |
if err != nil {
|
| 207 | 207 |
t.Errorf("Unexpected error creating mapping: %#v", err)
|
| 208 | 208 |
} |
| ... | ... |
@@ -21,7 +21,7 @@ func TestListRoutesEmptyList(t *testing.T) {
|
| 21 | 21 |
registry: mockRegistry, |
| 22 | 22 |
} |
| 23 | 23 |
|
| 24 |
- routes, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 24 |
+ routes, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 25 | 25 |
if err != nil {
|
| 26 | 26 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 27 | 27 |
} |
| ... | ... |
@@ -52,7 +52,7 @@ func TestListRoutesPopulatedList(t *testing.T) {
|
| 52 | 52 |
registry: mockRegistry, |
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 |
- list, err := storage.List(labels.Everything(), labels.Everything()) |
|
| 55 |
+ list, err := storage.List(nil, labels.Everything(), labels.Everything()) |
|
| 56 | 56 |
if err != nil {
|
| 57 | 57 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 58 | 58 |
} |
| ... | ... |
@@ -67,7 +67,7 @@ func TestListRoutesPopulatedList(t *testing.T) {
|
| 67 | 67 |
func TestCreateRouteBadObject(t *testing.T) {
|
| 68 | 68 |
storage := REST{}
|
| 69 | 69 |
|
| 70 |
- channel, err := storage.Create(&api.RouteList{})
|
|
| 70 |
+ channel, err := storage.Create(nil, &api.RouteList{})
|
|
| 71 | 71 |
if channel != nil {
|
| 72 | 72 |
t.Errorf("Expected nil, got %v", channel)
|
| 73 | 73 |
} |
| ... | ... |
@@ -80,9 +80,9 @@ func TestCreateRouteOK(t *testing.T) {
|
| 80 | 80 |
mockRegistry := test.NewRouteRegistry() |
| 81 | 81 |
storage := REST{registry: mockRegistry}
|
| 82 | 82 |
|
| 83 |
- channel, err := storage.Create(&api.Route{
|
|
| 84 |
- JSONBase: kubeapi.JSONBase{ID: "foo"},
|
|
| 85 |
- Host: "www.frontend.com", |
|
| 83 |
+ channel, err := storage.Create(nil, &api.Route{
|
|
| 84 |
+ JSONBase: kubeapi.JSONBase{ID: "foo"},
|
|
| 85 |
+ Host: "www.frontend.com", |
|
| 86 | 86 |
ServiceName: "myrubyservice", |
| 87 | 87 |
}) |
| 88 | 88 |
if channel == nil {
|
| ... | ... |
@@ -111,7 +111,7 @@ func TestGetRouteError(t *testing.T) {
|
| 111 | 111 |
mockRegistry := test.NewRouteRegistry() |
| 112 | 112 |
storage := REST{registry: mockRegistry}
|
| 113 | 113 |
|
| 114 |
- route, err := storage.Get("foo")
|
|
| 114 |
+ route, err := storage.Get(nil, "foo") |
|
| 115 | 115 |
if route != nil {
|
| 116 | 116 |
t.Errorf("Unexpected non-nil route: %#v", route)
|
| 117 | 117 |
} |
| ... | ... |
@@ -132,7 +132,7 @@ func TestGetRouteOK(t *testing.T) {
|
| 132 | 132 |
} |
| 133 | 133 |
storage := REST{registry: mockRegistry}
|
| 134 | 134 |
|
| 135 |
- route, err := storage.Get("foo")
|
|
| 135 |
+ route, err := storage.Get(nil, "foo") |
|
| 136 | 136 |
if route == nil {
|
| 137 | 137 |
t.Error("Unexpected nil route")
|
| 138 | 138 |
} |
| ... | ... |
@@ -147,7 +147,7 @@ func TestGetRouteOK(t *testing.T) {
|
| 147 | 147 |
func TestUpdateRouteBadObject(t *testing.T) {
|
| 148 | 148 |
storage := REST{}
|
| 149 | 149 |
|
| 150 |
- channel, err := storage.Update(&api.RouteList{})
|
|
| 150 |
+ channel, err := storage.Update(nil, &api.RouteList{})
|
|
| 151 | 151 |
if channel != nil {
|
| 152 | 152 |
t.Errorf("Expected nil, got %v", channel)
|
| 153 | 153 |
} |
| ... | ... |
@@ -159,7 +159,7 @@ func TestUpdateRouteBadObject(t *testing.T) {
|
| 159 | 159 |
func TestUpdateRouteMissingID(t *testing.T) {
|
| 160 | 160 |
storage := REST{}
|
| 161 | 161 |
|
| 162 |
- channel, err := storage.Update(&api.Route{})
|
|
| 162 |
+ channel, err := storage.Update(nil, &api.Route{})
|
|
| 163 | 163 |
if channel != nil {
|
| 164 | 164 |
t.Errorf("Expected nil, got %v", channel)
|
| 165 | 165 |
} |
| ... | ... |
@@ -172,9 +172,9 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 172 | 172 |
mockRepositoryRegistry := test.NewRouteRegistry() |
| 173 | 173 |
storage := REST{registry: mockRepositoryRegistry}
|
| 174 | 174 |
|
| 175 |
- channel, err := storage.Update(&api.Route{
|
|
| 176 |
- JSONBase: kubeapi.JSONBase{ID: "foo"},
|
|
| 177 |
- Host: "www.frontend.com", |
|
| 175 |
+ channel, err := storage.Update(nil, &api.Route{
|
|
| 176 |
+ JSONBase: kubeapi.JSONBase{ID: "foo"},
|
|
| 177 |
+ Host: "www.frontend.com", |
|
| 178 | 178 |
ServiceName: "rubyservice", |
| 179 | 179 |
}) |
| 180 | 180 |
if err != nil {
|
| ... | ... |
@@ -185,7 +185,7 @@ func TestUpdateRegistryErrorSaving(t *testing.T) {
|
| 185 | 185 |
if !ok {
|
| 186 | 186 |
t.Errorf("Expected status, got %#v", result)
|
| 187 | 187 |
} |
| 188 |
- if status.Status != "failure" || status.Message != "Route foo not found" {
|
|
| 188 |
+ if status.Status != kubeapi.StatusFailure || status.Message != "Route foo not found" {
|
|
| 189 | 189 |
t.Errorf("Expected status=failure, message=Route foo not found, got %#v", status)
|
| 190 | 190 |
} |
| 191 | 191 |
} |
| ... | ... |
@@ -195,8 +195,8 @@ func TestUpdateRouteOK(t *testing.T) {
|
| 195 | 195 |
mockRepositoryRegistry.Routes = &api.RouteList{
|
| 196 | 196 |
Items: []api.Route{
|
| 197 | 197 |
{
|
| 198 |
- JSONBase: kubeapi.JSONBase{ID: "bar"},
|
|
| 199 |
- Host: "www.frontend.com", |
|
| 198 |
+ JSONBase: kubeapi.JSONBase{ID: "bar"},
|
|
| 199 |
+ Host: "www.frontend.com", |
|
| 200 | 200 |
ServiceName: "rubyservice", |
| 201 | 201 |
}, |
| 202 | 202 |
}, |
| ... | ... |
@@ -204,12 +204,12 @@ func TestUpdateRouteOK(t *testing.T) {
|
| 204 | 204 |
|
| 205 | 205 |
storage := REST{registry: mockRepositoryRegistry}
|
| 206 | 206 |
|
| 207 |
- channel, err := storage.Update(&api.Route{
|
|
| 208 |
- JSONBase: kubeapi.JSONBase{ID: "bar"},
|
|
| 209 |
- Host: "www.newfrontend.com", |
|
| 207 |
+ channel, err := storage.Update(nil, &api.Route{
|
|
| 208 |
+ JSONBase: kubeapi.JSONBase{ID: "bar"},
|
|
| 209 |
+ Host: "www.newfrontend.com", |
|
| 210 | 210 |
ServiceName: "newrubyservice", |
| 211 | 211 |
}) |
| 212 |
- |
|
| 212 |
+ |
|
| 213 | 213 |
if err != nil {
|
| 214 | 214 |
t.Errorf("Unexpected non-nil error: %#v", err)
|
| 215 | 215 |
} |
| ... | ... |
@@ -236,7 +236,7 @@ func TestUpdateRouteOK(t *testing.T) {
|
| 236 | 236 |
func TestDeleteRouteError(t *testing.T) {
|
| 237 | 237 |
mockRegistry := test.NewRouteRegistry() |
| 238 | 238 |
storage := REST{registry: mockRegistry}
|
| 239 |
- _, err := storage.Delete("foo")
|
|
| 239 |
+ _, err := storage.Delete(nil, "foo") |
|
| 240 | 240 |
if err == nil {
|
| 241 | 241 |
t.Errorf("Unexpected nil error: %#v", err)
|
| 242 | 242 |
} |
| ... | ... |
@@ -255,7 +255,7 @@ func TestDeleteRouteOk(t *testing.T) {
|
| 255 | 255 |
}, |
| 256 | 256 |
} |
| 257 | 257 |
storage := REST{registry: mockRegistry}
|
| 258 |
- channel, err := storage.Delete("foo")
|
|
| 258 |
+ channel, err := storage.Delete(nil, "foo") |
|
| 259 | 259 |
if channel == nil {
|
| 260 | 260 |
t.Error("Unexpected nil channel")
|
| 261 | 261 |
} |
| ... | ... |
@@ -269,7 +269,7 @@ func TestDeleteRouteOk(t *testing.T) {
|
| 269 | 269 |
if !ok {
|
| 270 | 270 |
t.Errorf("Expected status type, got: %#v", result)
|
| 271 | 271 |
} |
| 272 |
- if status.Status != "success" {
|
|
| 272 |
+ if status.Status != kubeapi.StatusSuccess {
|
|
| 273 | 273 |
t.Errorf("Expected status=success, got: %#v", status)
|
| 274 | 274 |
} |
| 275 | 275 |
case <-time.After(50 * time.Millisecond): |
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
|
| 10 | 10 |
func TestNewStorageInvalidType(t *testing.T) {
|
| 11 | 11 |
storage := NewStorage() |
| 12 |
- _, err := storage.Create(&kubeapi.Pod{})
|
|
| 12 |
+ _, err := storage.Create(nil, &kubeapi.Pod{})
|
|
| 13 | 13 |
if err == nil {
|
| 14 | 14 |
t.Errorf("Expected type error.")
|
| 15 | 15 |
} |
| ... | ... |
@@ -18,19 +18,19 @@ func TestNewStorageInvalidType(t *testing.T) {
|
| 18 | 18 |
func TestStorageNotImplementedFunctions(t *testing.T) {
|
| 19 | 19 |
storage := NewStorage() |
| 20 | 20 |
|
| 21 |
- if _, err := storage.List(nil, nil); err == nil {
|
|
| 21 |
+ if _, err := storage.List(nil, nil, nil); err == nil {
|
|
| 22 | 22 |
t.Errorf("Expected not implemented error.")
|
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 |
- if _, err := storage.Get(""); err == nil {
|
|
| 25 |
+ if _, err := storage.Get(nil, ""); err == nil {
|
|
| 26 | 26 |
t.Errorf("Expected not implemented error.")
|
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 |
- if _, err := storage.Update(nil); err == nil {
|
|
| 29 |
+ if _, err := storage.Update(nil, nil); err == nil {
|
|
| 30 | 30 |
t.Errorf("Expected not implemented error.")
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 |
- channel, err := storage.Delete("")
|
|
| 33 |
+ channel, err := storage.Delete(nil, "") |
|
| 34 | 34 |
if err != nil {
|
| 35 | 35 |
t.Errorf("Unexpected error when deleting: %v", err)
|
| 36 | 36 |
} |
| ... | ... |
@@ -78,5 +78,5 @@ func ExampleProcessTemplateParameters() {
|
| 78 | 78 |
result, _ := latest.Codec.Encode(config) |
| 79 | 79 |
fmt.Println(string(result)) |
| 80 | 80 |
// Output: |
| 81 |
- //{"kind":"Config","id":"guestbook","creationTimestamp":"1980-01-01T00:00:00Z","apiVersion":"v1beta1","name":"guestbook-example","description":"Example shows how to build a simple multi-tier application using Kubernetes and Docker","items":[{"kind":"Route","id":"frontendroute","creationTimestamp":null,"apiVersion":"v1beta1","host":"guestbook.example.com","serviceName":"frontend","labels":{"name":"frontend"}},{"kind":"Service","id":"frontend","creationTimestamp":null,"apiVersion":"v1beta1","port":5432,"selector":{"name":"frontend"},"containerPort":0},{"kind":"Service","id":"redismaster","creationTimestamp":null,"apiVersion":"v1beta1","port":10000,"selector":{"name":"redis-master"},"containerPort":0},{"kind":"Service","id":"redisslave","creationTimestamp":null,"apiVersion":"v1beta1","port":10001,"labels":{"name":"redisslave"},"selector":{"name":"redisslave"},"containerPort":0},{"kind":"Pod","id":"redis-master-2","creationTimestamp":null,"apiVersion":"v1beta1","labels":{"name":"redis-master"},"desiredState":{"manifest":{"version":"v1beta1","id":"redis-master-2","volumes":null,"containers":[{"name":"master","image":"dockerfile/redis","ports":[{"containerPort":6379}],"env":[{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}]}],"restartPolicy":{}}},"currentState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}},{"kind":"ReplicationController","id":"frontendController","creationTimestamp":null,"apiVersion":"v1beta1","desiredState":{"replicas":3,"replicaSelector":{"name":"frontend"},"podTemplate":{"desiredState":{"manifest":{"version":"v1beta1","id":"frontendController","volumes":null,"containers":[{"name":"php-redis","image":"brendanburns/php-redis","ports":[{"hostPort":8000,"containerPort":80}],"env":[{"name":"ADMIN_USERNAME","key":"ADMIN_USERNAME","value":"adminQ3H"},{"name":"ADMIN_PASSWORD","key":"ADMIN_PASSWORD","value":"dwNJiJwW"},{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}]}],"restartPolicy":{}}},"labels":{"name":"frontend"}}},"currentState":{"replicas":0,"podTemplate":{"desiredState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}}},"labels":{"name":"frontend"}},{"kind":"ReplicationController","id":"redisSlaveController","creationTimestamp":null,"apiVersion":"v1beta1","desiredState":{"replicas":2,"replicaSelector":{"name":"redisslave"},"podTemplate":{"desiredState":{"manifest":{"version":"v1beta1","id":"redisSlaveController","volumes":null,"containers":[{"name":"slave","image":"brendanburns/redis-slave","ports":[{"hostPort":6380,"containerPort":6379}],"env":[{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}]}],"restartPolicy":{}}},"labels":{"name":"redisslave"}}},"currentState":{"replicas":0,"podTemplate":{"desiredState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}}},"labels":{"name":"redisslave"}}]}
|
|
| 81 |
+ //{"kind":"Config","id":"guestbook","creationTimestamp":"1980-01-01T00:00:00Z","apiVersion":"v1beta1","namespace":"","name":"guestbook-example","description":"Example shows how to build a simple multi-tier application using Kubernetes and Docker","items":[{"kind":"Route","id":"frontendroute","creationTimestamp":null,"apiVersion":"v1beta1","namespace":"","host":"guestbook.example.com","serviceName":"frontend","labels":{"name":"frontend"}},{"kind":"Service","id":"frontend","creationTimestamp":null,"apiVersion":"v1beta1","namespace":"","port":5432,"selector":{"name":"frontend"},"containerPort":0},{"kind":"Service","id":"redismaster","creationTimestamp":null,"apiVersion":"v1beta1","namespace":"","port":10000,"selector":{"name":"redis-master"},"containerPort":0},{"kind":"Service","id":"redisslave","creationTimestamp":null,"apiVersion":"v1beta1","namespace":"","port":10001,"labels":{"name":"redisslave"},"selector":{"name":"redisslave"},"containerPort":0},{"kind":"Pod","id":"redis-master-2","creationTimestamp":null,"apiVersion":"v1beta1","namespace":"","labels":{"name":"redis-master"},"desiredState":{"manifest":{"version":"v1beta1","id":"redis-master-2","volumes":null,"containers":[{"name":"master","image":"dockerfile/redis","ports":[{"containerPort":6379}],"env":[{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}],"imagePullPolicy":""}],"restartPolicy":{}}},"currentState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}},{"kind":"ReplicationController","id":"frontendController","creationTimestamp":null,"apiVersion":"v1beta1","namespace":"","desiredState":{"replicas":3,"replicaSelector":{"name":"frontend"},"podTemplate":{"desiredState":{"manifest":{"version":"v1beta1","id":"frontendController","volumes":null,"containers":[{"name":"php-redis","image":"brendanburns/php-redis","ports":[{"hostPort":8000,"containerPort":80}],"env":[{"name":"ADMIN_USERNAME","key":"ADMIN_USERNAME","value":"adminQ3H"},{"name":"ADMIN_PASSWORD","key":"ADMIN_PASSWORD","value":"dwNJiJwW"},{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}],"imagePullPolicy":""}],"restartPolicy":{}}},"labels":{"name":"frontend"}}},"currentState":{"replicas":0,"podTemplate":{"desiredState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}}},"labels":{"name":"frontend"}},{"kind":"ReplicationController","id":"redisSlaveController","creationTimestamp":null,"apiVersion":"v1beta1","namespace":"","desiredState":{"replicas":2,"replicaSelector":{"name":"redisslave"},"podTemplate":{"desiredState":{"manifest":{"version":"v1beta1","id":"redisSlaveController","volumes":null,"containers":[{"name":"slave","image":"brendanburns/redis-slave","ports":[{"hostPort":6380,"containerPort":6379}],"env":[{"name":"REDIS_PASSWORD","key":"REDIS_PASSWORD","value":"P8vxbV4C"}],"imagePullPolicy":""}],"restartPolicy":{}}},"labels":{"name":"redisslave"}}},"currentState":{"replicas":0,"podTemplate":{"desiredState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}}},"labels":{"name":"redisslave"}}]}
|
|
| 82 | 82 |
} |
| ... | ... |
@@ -35,8 +35,8 @@ func TestBuildConfigClient(t *testing.T) {
|
| 35 | 35 |
m := master.New(&master.Config{
|
| 36 | 36 |
EtcdHelper: helper, |
| 37 | 37 |
}) |
| 38 |
- codec, versioner, _ := latest.InterfacesFor(latest.Version) |
|
| 39 |
- buildRegistry := buildetcd.New(tools.EtcdHelper{etcdClient, codec, versioner})
|
|
| 38 |
+ interfaces, _ := latest.InterfacesFor(latest.Version) |
|
| 39 |
+ buildRegistry := buildetcd.New(tools.EtcdHelper{etcdClient, interfaces.Codec, interfaces.ResourceVersioner})
|
|
| 40 | 40 |
storage := map[string]apiserver.RESTStorage{
|
| 41 | 41 |
"builds": buildregistry.NewREST(buildRegistry), |
| 42 | 42 |
"buildConfigs": buildconfigregistry.NewREST(buildRegistry), |
| ... | ... |
@@ -44,12 +44,12 @@ func TestBuildConfigClient(t *testing.T) {
|
| 44 | 44 |
|
| 45 | 45 |
osMux := http.NewServeMux() |
| 46 | 46 |
apiserver.NewAPIGroup(m.API_v1beta1()).InstallREST(osMux, "/api/v1beta1") |
| 47 |
- apiserver.NewAPIGroup(storage, v1beta1.Codec).InstallREST(osMux, "/osapi/v1beta1") |
|
| 47 |
+ apiserver.NewAPIGroup(storage, v1beta1.Codec, "/osapi/v1beta1", interfaces.SelfLinker).InstallREST(osMux, "/osapi/v1beta1") |
|
| 48 | 48 |
apiserver.InstallSupport(osMux) |
| 49 | 49 |
s := httptest.NewServer(osMux) |
| 50 | 50 |
|
| 51 |
- kubeclient := client.NewOrDie(s.URL, klatest.Version, nil) |
|
| 52 |
- osclient, _ := osclient.New(s.URL, latest.Version, nil) |
|
| 51 |
+ kubeclient := client.NewOrDie(&client.Config{Host: s.URL, Version: klatest.Version})
|
|
| 52 |
+ osClient := osclient.NewOrDie(&client.Config{Host: s.URL, Version: latest.Version})
|
|
| 53 | 53 |
|
| 54 | 54 |
info, err := kubeclient.ServerVersion() |
| 55 | 55 |
if err != nil {
|
| ... | ... |
@@ -59,7 +59,7 @@ func TestBuildConfigClient(t *testing.T) {
|
| 59 | 59 |
t.Errorf("expected %#v, got %#v", e, a)
|
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 |
- buildConfigs, err := osclient.ListBuildConfigs(labels.Everything()) |
|
| 62 |
+ buildConfigs, err := osClient.ListBuildConfigs(labels.Everything()) |
|
| 63 | 63 |
if err != nil {
|
| 64 | 64 |
t.Fatalf("unexpected error %v", err)
|
| 65 | 65 |
} |
| ... | ... |
@@ -80,14 +80,14 @@ func TestBuildConfigClient(t *testing.T) {
|
| 80 | 80 |
BuilderImage: "anImage", |
| 81 | 81 |
}, |
| 82 | 82 |
} |
| 83 |
- got, err := osclient.CreateBuildConfig(buildConfig) |
|
| 83 |
+ got, err := osClient.CreateBuildConfig(buildConfig) |
|
| 84 | 84 |
if err == nil {
|
| 85 | 85 |
t.Fatalf("unexpected non-error: %v", err)
|
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 | 88 |
// get a created buildConfig |
| 89 | 89 |
buildConfig.DesiredInput.BuilderImage = "" |
| 90 |
- got, err = osclient.CreateBuildConfig(buildConfig) |
|
| 90 |
+ got, err = osClient.CreateBuildConfig(buildConfig) |
|
| 91 | 91 |
if err != nil {
|
| 92 | 92 |
t.Fatalf("unexpected error: %v", err)
|
| 93 | 93 |
} |
| ... | ... |
@@ -96,7 +96,7 @@ func TestBuildConfigClient(t *testing.T) {
|
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 | 98 |
// get a list of buildConfigs |
| 99 |
- buildConfigs, err = osclient.ListBuildConfigs(labels.Everything()) |
|
| 99 |
+ buildConfigs, err = osClient.ListBuildConfigs(labels.Everything()) |
|
| 100 | 100 |
if err != nil {
|
| 101 | 101 |
t.Fatalf("unexpected error: %v", err)
|
| 102 | 102 |
} |
| ... | ... |
@@ -109,11 +109,11 @@ func TestBuildConfigClient(t *testing.T) {
|
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 | 111 |
// delete a buildConfig |
| 112 |
- err = osclient.DeleteBuildConfig(got.ID) |
|
| 112 |
+ err = osClient.DeleteBuildConfig(got.ID) |
|
| 113 | 113 |
if err != nil {
|
| 114 | 114 |
t.Fatalf("unexpected error %v", err)
|
| 115 | 115 |
} |
| 116 |
- buildConfigs, err = osclient.ListBuildConfigs(labels.Everything()) |
|
| 116 |
+ buildConfigs, err = osClient.ListBuildConfigs(labels.Everything()) |
|
| 117 | 117 |
if err != nil {
|
| 118 | 118 |
t.Fatalf("unexpected error %v", err)
|
| 119 | 119 |
} |
| ... | ... |
@@ -35,8 +35,8 @@ func TestBuildClient(t *testing.T) {
|
| 35 | 35 |
m := master.New(&master.Config{
|
| 36 | 36 |
EtcdHelper: helper, |
| 37 | 37 |
}) |
| 38 |
- codec, versioner, _ := latest.InterfacesFor(latest.Version) |
|
| 39 |
- buildRegistry := buildetcd.New(tools.EtcdHelper{etcdClient, codec, versioner})
|
|
| 38 |
+ interfaces, _ := latest.InterfacesFor(latest.Version) |
|
| 39 |
+ buildRegistry := buildetcd.New(tools.EtcdHelper{etcdClient, interfaces.Codec, interfaces.ResourceVersioner})
|
|
| 40 | 40 |
storage := map[string]apiserver.RESTStorage{
|
| 41 | 41 |
"builds": buildregistry.NewREST(buildRegistry), |
| 42 | 42 |
"buildConfigs": buildconfigregistry.NewREST(buildRegistry), |
| ... | ... |
@@ -44,12 +44,12 @@ func TestBuildClient(t *testing.T) {
|
| 44 | 44 |
|
| 45 | 45 |
osMux := http.NewServeMux() |
| 46 | 46 |
apiserver.NewAPIGroup(m.API_v1beta1()).InstallREST(osMux, "/api/v1beta1") |
| 47 |
- apiserver.NewAPIGroup(storage, v1beta1.Codec).InstallREST(osMux, "/osapi/v1beta1") |
|
| 47 |
+ apiserver.NewAPIGroup(storage, v1beta1.Codec, "/osapi/v1beta1", interfaces.SelfLinker).InstallREST(osMux, "/osapi/v1beta1") |
|
| 48 | 48 |
apiserver.InstallSupport(osMux) |
| 49 | 49 |
s := httptest.NewServer(osMux) |
| 50 | 50 |
|
| 51 |
- kubeclient := client.NewOrDie(s.URL, klatest.Version, nil) |
|
| 52 |
- osclient, _ := osclient.New(s.URL, latest.Version, nil) |
|
| 51 |
+ kubeclient := client.NewOrDie(&client.Config{Host: s.URL, Version: klatest.Version})
|
|
| 52 |
+ osClient := osclient.NewOrDie(&client.Config{Host: s.URL, Version: latest.Version})
|
|
| 53 | 53 |
|
| 54 | 54 |
info, err := kubeclient.ServerVersion() |
| 55 | 55 |
if err != nil {
|
| ... | ... |
@@ -59,7 +59,7 @@ func TestBuildClient(t *testing.T) {
|
| 59 | 59 |
t.Errorf("expected %#v, got %#v", e, a)
|
| 60 | 60 |
} |
| 61 | 61 |
|
| 62 |
- builds, err := osclient.ListBuilds(labels.Everything()) |
|
| 62 |
+ builds, err := osClient.ListBuilds(labels.Everything()) |
|
| 63 | 63 |
if err != nil {
|
| 64 | 64 |
t.Fatalf("unexpected error %v", err)
|
| 65 | 65 |
} |
| ... | ... |
@@ -80,14 +80,14 @@ func TestBuildClient(t *testing.T) {
|
| 80 | 80 |
BuilderImage: "anImage", |
| 81 | 81 |
}, |
| 82 | 82 |
} |
| 83 |
- got, err := osclient.CreateBuild(build) |
|
| 83 |
+ got, err := osClient.CreateBuild(build) |
|
| 84 | 84 |
if err == nil {
|
| 85 | 85 |
t.Fatalf("unexpected non-error: %v", err)
|
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 | 88 |
// get a created build |
| 89 | 89 |
build.Input.BuilderImage = "" |
| 90 |
- got, err = osclient.CreateBuild(build) |
|
| 90 |
+ got, err = osClient.CreateBuild(build) |
|
| 91 | 91 |
if err != nil {
|
| 92 | 92 |
t.Fatalf("unexpected error: %v", err)
|
| 93 | 93 |
} |
| ... | ... |
@@ -96,7 +96,7 @@ func TestBuildClient(t *testing.T) {
|
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 | 98 |
// get a list of builds |
| 99 |
- builds, err = osclient.ListBuilds(labels.Everything()) |
|
| 99 |
+ builds, err = osClient.ListBuilds(labels.Everything()) |
|
| 100 | 100 |
if err != nil {
|
| 101 | 101 |
t.Fatalf("unexpected error: %v", err)
|
| 102 | 102 |
} |
| ... | ... |
@@ -112,11 +112,11 @@ func TestBuildClient(t *testing.T) {
|
| 112 | 112 |
} |
| 113 | 113 |
|
| 114 | 114 |
// delete a build |
| 115 |
- err = osclient.DeleteBuild(got.ID) |
|
| 115 |
+ err = osClient.DeleteBuild(got.ID) |
|
| 116 | 116 |
if err != nil {
|
| 117 | 117 |
t.Fatalf("unexpected error %v", err)
|
| 118 | 118 |
} |
| 119 |
- builds, err = osclient.ListBuilds(labels.Everything()) |
|
| 119 |
+ builds, err = osClient.ListBuilds(labels.Everything()) |
|
| 120 | 120 |
if err != nil {
|
| 121 | 121 |
t.Fatalf("unexpected error %v", err)
|
| 122 | 122 |
} |
| ... | ... |
@@ -115,8 +115,8 @@ func setup(t *testing.T) (*osclient.Client, string) {
|
| 115 | 115 |
m := master.New(&master.Config{
|
| 116 | 116 |
EtcdHelper: helper, |
| 117 | 117 |
}) |
| 118 |
- codec, versioner, _ := latest.InterfacesFor(latest.Version) |
|
| 119 |
- buildRegistry := buildetcd.New(tools.EtcdHelper{etcdClient, codec, versioner})
|
|
| 118 |
+ interfaces, _ := latest.InterfacesFor(latest.Version) |
|
| 119 |
+ buildRegistry := buildetcd.New(tools.EtcdHelper{etcdClient, interfaces.Codec, interfaces.ResourceVersioner})
|
|
| 120 | 120 |
storage := map[string]apiserver.RESTStorage{
|
| 121 | 121 |
"builds": buildregistry.NewREST(buildRegistry), |
| 122 | 122 |
"buildConfigs": buildconfigregistry.NewREST(buildRegistry), |
| ... | ... |
@@ -125,12 +125,12 @@ func setup(t *testing.T) (*osclient.Client, string) {
|
| 125 | 125 |
osMux := http.NewServeMux() |
| 126 | 126 |
apiserver.NewAPIGroup(m.API_v1beta1()).InstallREST(osMux, "/api/v1beta1") |
| 127 | 127 |
osPrefix := "/osapi/v1beta1" |
| 128 |
- apiserver.NewAPIGroup(storage, v1beta1.Codec).InstallREST(osMux, osPrefix) |
|
| 128 |
+ apiserver.NewAPIGroup(storage, v1beta1.Codec, osPrefix, interfaces.SelfLinker).InstallREST(osMux, osPrefix) |
|
| 129 | 129 |
apiserver.InstallSupport(osMux) |
| 130 | 130 |
s := httptest.NewServer(osMux) |
| 131 | 131 |
|
| 132 |
- kubeclient := client.NewOrDie(s.URL, klatest.Version, nil) |
|
| 133 |
- osClient, _ := osclient.New(s.URL, latest.Version, nil) |
|
| 132 |
+ kubeclient := client.NewOrDie(&client.Config{Host: s.URL, Version: klatest.Version})
|
|
| 133 |
+ osClient := osclient.NewOrDie(&client.Config{Host: s.URL, Version: latest.Version})
|
|
| 134 | 134 |
|
| 135 | 135 |
whPrefix := osPrefix + "/buildConfigHooks/" |
| 136 | 136 |
osMux.Handle(whPrefix, http.StripPrefix(whPrefix, |