Skip to content

Commit

Permalink
continue on nil configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
juanvallejo committed Oct 16, 2017
1 parent 572fb85 commit d863f04
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func TestExampleObjectSchemas(t *testing.T) {
"../test/integration/testdata": {
// TODO fix this test to handle json and yaml
"project-request-template-with-quota": nil, // skip a yaml file
"test-replication-controller": nil, // skip &api.ReplicationController
"test-deployment-config": &deployapi.DeploymentConfig{},
"test-image": &imageapi.Image{},
"test-image-stream": &imageapi.ImageStream{},
Expand Down
3 changes: 2 additions & 1 deletion pkg/oc/cli/cmd/rollout/cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ func (o CancelOptions) Run() error {
for _, info := range o.Infos {
config, ok := info.Object.(*deployapi.DeploymentConfig)
if !ok {
allErrs = append(allErrs, kcmdutil.AddSourceToErr("cancelling", info.Source, fmt.Errorf("expected deployment configuration, got %T", info.Object)))
allErrs = append(allErrs, kcmdutil.AddSourceToErr("cancelling", info.Source, fmt.Errorf("expected deployment configuration, got %s", info.Mapping.Resource)))
continue
}
if config.Spec.Paused {
allErrs = append(allErrs, kcmdutil.AddSourceToErr("cancelling", info.Source, fmt.Errorf("unable to cancel paused deployment %s/%s", config.Namespace, config.Name)))
Expand Down
5 changes: 5 additions & 0 deletions test/cmd/deployments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ os::cmd::try_until_success 'oc rollout pause dc/database'
os::cmd::try_until_text "oc get dc/database --template='{{.spec.paused}}'" "true"
os::cmd::try_until_success 'oc rollout resume dc/database'
os::cmd::try_until_text "oc get dc/database --template='{{.spec.paused}}'" "<no value>"
# create a replication controller and attempt to perform `oc rollout cancel` on it.
# expect an error about the resource type, rather than a panic or a success.
os::cmd::expect_success 'oc create -f test/integration/testdata/test-replication-controller.yaml'
os::cmd::expect_failure_and_text 'oc rollout cancel rc/test-replication-controller' 'expected deployment configuration, got replicationcontrollers'

echo "rollout: ok"
os::test::junit::declare_suite_end

Expand Down
51 changes: 51 additions & 0 deletions test/extended/testdata/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions test/integration/testdata/test-replication-controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: v1
kind: ReplicationController
metadata:
annotations:
openshift.io/deployment-config.latest-version: "1"
openshift.io/deployment-config.name: test-deployment
openshift.io/deployment.phase: Complete
optnshift.io/deployment.replicas: "1"
name: test-replication-controller
spec:
replicas: 1
selector:
deployment: test-deployment
deploymentconfig: test-deployment
template:
metadata:
labels:
deployment: test-deployment
deploymentconfig: test-deployment
spec:
containers:
- image: openshift/origin-pod
imagePullPolicy: IfNotPresent
name: ruby-helloworld
ports:
- containerPort: 8080
protocol: TCP
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}

0 comments on commit d863f04

Please sign in to comment.