Skip to content

Commit 099f5ee

Browse files
committed
wip: add fake instantiate
1 parent aa2a577 commit 099f5ee

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package fake
2+
3+
import (
4+
"path"
5+
6+
apps "github.com/openshift/origin/pkg/deploy/apis/apps"
7+
runtime "k8s.io/apimachinery/pkg/runtime"
8+
schema "k8s.io/apimachinery/pkg/runtime/schema"
9+
testing "k8s.io/client-go/testing"
10+
)
11+
12+
// TODO: Move this into upstream client-go/testing/actions.go
13+
func NewCreateAction(resource schema.GroupVersionResource, namespace string, object runtime.Object, subresources ...string) CreateActionImpl {
14+
action := CreateActionImpl{}
15+
action.Verb = "create"
16+
action.SubResource = path.Join(subresources...)
17+
action.Resource = resource
18+
action.Namespace = namespace
19+
action.Object = object
20+
21+
return action
22+
}
23+
24+
func (c *FakeDeploymentConfigs) Instantiate(request *apps.DeploymentRequest) (*apps.DeploymentConfig, error) {
25+
obj, err := c.Fake.
26+
Invokes(testing.NewCreateSubresourceAction(deploymentconfigsResource, "deploymentConfigs", c.ns, request, "instantiate"), &apps.DeploymentConfig{})
27+
28+
if obj == nil {
29+
return nil, err
30+
}
31+
return obj.(*apps.DeploymentConfig), err
32+
}

0 commit comments

Comments
 (0)