Skip to content

Commit

Permalink
Replace oc run for dc/jobs and others with oc create equivalents
Browse files Browse the repository at this point in the history
1.18 rebase of oc no longer supports generators for various objects like dc, jobs, rc.
Equivalent oc create commands must be used instead.
  • Loading branch information
ingvagabund committed Mar 25, 2020
1 parent 927b43c commit 80fc120
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 26 deletions.
23 changes: 10 additions & 13 deletions test/extended/testdata/bindata.go

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

17 changes: 7 additions & 10 deletions test/extended/testdata/cmd/test/cmd/basicresources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -278,19 +278,16 @@ export KUBECONFIG="${temp_config}"
#os::cmd::expect_success 'oc new-project test-project-admin'
#os::cmd::try_until_success "oc project test-project-admin"

os::cmd::expect_success 'oc run --image=openshift/hello-openshift test'
os::cmd::expect_success 'oc run --image=openshift/hello-openshift --generator=run-controller/v1 test2'
os::cmd::expect_success 'oc create deploymentconfig --image=openshift/hello-openshift test'
os::cmd::expect_success 'oc run --image=openshift/hello-openshift --restart=Never test3'
os::cmd::expect_success 'oc run --image=openshift/hello-openshift --generator=job/v1 --restart=Never test4'
os::cmd::expect_success 'oc delete dc/test rc/test2 pod/test3 job/test4'
os::cmd::expect_success 'oc create job --image=openshift/hello-openshift test4'
os::cmd::expect_success 'oc delete dc/test pod/test3 job/test4'

os::cmd::expect_success_and_text 'oc run --dry-run foo --image=bar -o name' 'deploymentconfig.apps.openshift.io/foo'
os::cmd::expect_success_and_text 'oc run --dry-run foo --image=bar -o name --restart=Always' 'deploymentconfig.apps.openshift.io/foo'
os::cmd::expect_success_and_text 'oc create deploymentconfig --dry-run foo --image=bar -o name' 'deploymentconfig.apps.openshift.io/foo'
os::cmd::expect_success_and_text 'oc create deploymentconfig --dry-run foo --image=bar -o name --restart=Always' 'deploymentconfig.apps.openshift.io/foo'
os::cmd::expect_success_and_text 'oc run --dry-run foo --image=bar -o name --restart=Never' 'pod/foo'
os::cmd::expect_success_and_text 'oc run --dry-run foo --image=bar -o name --generator=job/v1' 'job.batch/foo'
os::cmd::expect_success_and_text 'oc run --dry-run foo --image=bar -o name --generator=deploymentconfig/v1' 'deploymentconfig.apps.openshift.io/foo'
os::cmd::expect_success_and_text 'oc run --dry-run foo --image=bar -o name --generator=run-controller/v1' 'replicationcontroller/foo'
os::cmd::expect_success_and_text 'oc run --dry-run foo --image=bar -o name --generator=run/v1' 'replicationcontroller/foo'
os::cmd::expect_success_and_text 'oc create job --dry-run foo --image=bar -o name' 'job.batch/foo'
os::cmd::expect_success_and_text 'oc create deploymentconfig --dry-run foo --image=bar -o name --generator=deploymentconfig/v1' 'deploymentconfig.apps.openshift.io/foo'
os::cmd::expect_success_and_text 'oc run --dry-run foo --image=bar -o name --generator=run-pod/v1' 'pod/foo'

os::cmd::expect_success 'oc process -f ${TEST_DATA}/application-template-stibuild.json -l name=mytemplate | oc create -f -'
Expand Down
2 changes: 1 addition & 1 deletion test/extended/testdata/cmd/test/cmd/image-lookup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ os::cmd::expect_success_and_text "oc set image-lookup is/nginx" "updated"
os::cmd::expect_success "oc run --generator=run-pod/v1 --restart=Never --image=nginx:latest nginx"
os::cmd::expect_success_and_text "oc get pod/nginx -o jsonpath='{.spec.containers[0].image}'" "nginx@sha256:"
## Image lookup works for jobs
os::cmd::expect_success "oc run --generator=job/v1 --restart=Never --image=nginx:latest nginx"
os::cmd::expect_success "oc create job --image=nginx:latest nginx"
os::cmd::expect_success_and_text "oc get job/nginx -o jsonpath='{.spec.template.spec.containers[0].image}'" "nginx@sha256:"
## Image lookup works for replica sets
os::cmd::expect_success "oc create deployment --image=nginx:latest nginx"
Expand Down
2 changes: 1 addition & 1 deletion test/extended/testdata/cmd/test/cmd/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ trap os::test::junit::reconcile_output EXIT

os::test::junit::declare_suite_start "cmd/run"
# This test validates the value of --image for oc run
os::cmd::expect_success_and_text 'oc run newdcforimage --image=validimagevalue' 'deploymentconfig.apps.openshift.io/newdcforimage created'
os::cmd::expect_success_and_text 'oc create deploymentconfig newdcforimage --image=validimagevalue' 'deploymentconfig.apps.openshift.io/newdcforimage created'
os::cmd::expect_failure_and_text 'oc run newdcforimage2 --image="InvalidImageValue0192"' 'error: Invalid image name "InvalidImageValue0192": invalid reference format'
os::cmd::expect_failure_and_text 'oc run test1 --image=busybox --attach --dry-run' "dry-run can't be used with attached containers options"
os::cmd::expect_failure_and_text 'oc run test1 --image=busybox --stdin --dry-run' "dry-run can't be used with attached containers options"
Expand Down
2 changes: 1 addition & 1 deletion test/extended/testdata/cmd/test/cmd/status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ os::cmd::expect_success_and_text 'oc status -v' 'shorthand -v has been deprecate
os::cmd::expect_success_and_text 'oc status --verbose' '\-\-verbose has been deprecated'

# Verify jobs are showing in status
os::cmd::expect_success "oc run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'"
os::cmd::expect_success "oc create job pi --image=perl -- perl -Mbignum=bpi -wle 'print bpi(2000)'"
os::cmd::expect_success_and_text "oc status" "job/pi manages perl"

# logout
Expand Down

0 comments on commit 80fc120

Please sign in to comment.