Skip to content

Commit

Permalink
Move image administrative commands tests to admin.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
soltysh committed Jul 27, 2016
1 parent 8ee285c commit c2a49c7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
6 changes: 0 additions & 6 deletions hack/test-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,6 @@ os::cmd::expect_success_and_text 'oc config view' "current-context.+/${API_HOST}
os::cmd::expect_success 'oc logout'
os::cmd::expect_failure_and_text 'oc get pods' '"system:anonymous" cannot list pods'

# log in as an image-pruner and test that oadm prune images works against the atomic binary
os::cmd::expect_success "oadm policy add-cluster-role-to-user system:image-pruner pruner --config='${MASTER_CONFIG_DIR}/admin.kubeconfig'"
os::cmd::expect_success "oc login --server=${KUBERNETES_MASTER} --certificate-authority='${MASTER_CONFIG_DIR}/ca.crt' -u pruner -p anything"
# this shouldn't fail but instead output "Dry run enabled - no modifications will be made. Add --confirm to remove images"
os::cmd::expect_success 'oadm prune images'

# log in and set project to use from now on
VERBOSE=true os::cmd::expect_success "oc login --server=${KUBERNETES_MASTER} --certificate-authority='${MASTER_CONFIG_DIR}/ca.crt' -u test-user -p anything"
VERBOSE=true os::cmd::expect_success 'oc get projects'
Expand Down
17 changes: 17 additions & 0 deletions test/cmd/admin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -481,4 +481,21 @@ os::cmd::expect_success_and_text 'oc describe identity test-idp:test-uid' 'test-
os::cmd::expect_success_and_text 'oc describe user test-cmd-user' 'test-idp:test-uid'
os::test::junit::declare_suite_end

# images
os::test::junit::declare_suite_start "cmd/admin/images"

# log in as an image-pruner and test that oadm prune images works against the atomic binary
os::cmd::expect_success "oadm policy add-cluster-role-to-user system:image-pruner pruner --config='${MASTER_CONFIG_DIR}/admin.kubeconfig'"
os::cmd::expect_success "oc login --server=${KUBERNETES_MASTER} --certificate-authority='${MASTER_CONFIG_DIR}/ca.crt' -u pruner -p anything"
os::cmd::expect_success_and_text "oadm prune images" "Dry run enabled - no modifications will be made. Add --confirm to remove images"

# import image and check its information
os::cmd::expect_success "oc new-project pruner"
os::cmd::expect_success "oc import-image busybox:latest --confirm -n pruner"
os::cmd::expect_success_and_text "oadm top images" "pruner/busybox:latest"
os::cmd::expect_success_and_text "oadm top imagestreams" "pruner/busybox"

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

os::test::junit::declare_suite_end

0 comments on commit c2a49c7

Please sign in to comment.