Merge pull request #15809 from mikedanese/deploy

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot
2015-10-27 19:25:12 -07:00
8 changed files with 121 additions and 6 deletions

View File

@@ -34,8 +34,9 @@ type DeploymentInterface interface {
List(label labels.Selector, field fields.Selector) (*extensions.DeploymentList, error)
Get(name string) (*extensions.Deployment, error)
Delete(name string, options *api.DeleteOptions) error
Create(Deployment *extensions.Deployment) (*extensions.Deployment, error)
Update(Deployment *extensions.Deployment) (*extensions.Deployment, error)
Create(*extensions.Deployment) (*extensions.Deployment, error)
Update(*extensions.Deployment) (*extensions.Deployment, error)
UpdateStatus(*extensions.Deployment) (*extensions.Deployment, error)
Watch(label labels.Selector, field fields.Selector, opts api.ListOptions) (watch.Interface, error)
}
@@ -93,6 +94,12 @@ func (c *deployments) Update(deployment *extensions.Deployment) (result *extensi
return
}
func (c *deployments) UpdateStatus(deployment *extensions.Deployment) (result *extensions.Deployment, err error) {
result = &extensions.Deployment{}
err = c.client.Put().Namespace(c.ns).Resource("deployments").Name(deployment.Name).SubResource("status").Body(deployment).Do().Into(result)
return
}
// Watch returns a watch.Interface that watches the requested deployments.
func (c *deployments) Watch(label labels.Selector, field fields.Selector, opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().

View File

@@ -124,6 +124,27 @@ func TestDeploymentUpdate(t *testing.T) {
c.Validate(t, response, err)
}
func TestDeploymentUpdateStatus(t *testing.T) {
ns := api.NamespaceDefault
deployment := &extensions.Deployment{
ObjectMeta: api.ObjectMeta{
Name: "abc",
Namespace: ns,
ResourceVersion: "1",
},
}
c := &testClient{
Request: testRequest{
Method: "PUT",
Path: testapi.Extensions.ResourcePath(getDeploymentsResoureName(), ns, "abc") + "/status",
Query: buildQueryValues(nil),
},
Response: Response{StatusCode: 200, Body: deployment},
}
response, err := c.Setup(t).Deployments(ns).UpdateStatus(deployment)
c.Validate(t, response, err)
}
func TestDeploymentDelete(t *testing.T) {
ns := api.NamespaceDefault
c := &testClient{

View File

@@ -72,6 +72,15 @@ func (c *FakeDeployments) Update(deployment *extensions.Deployment) (*extensions
return obj.(*extensions.Deployment), err
}
func (c *FakeDeployments) UpdateStatus(deployment *extensions.Deployment) (*extensions.Deployment, error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("deployments", "status", c.Namespace, deployment), deployment)
if obj == nil {
return nil, err
}
return obj.(*extensions.Deployment), err
}
func (c *FakeDeployments) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("deployments", c.Namespace, name), &extensions.Deployment{})
return err