github.com/jmrodri/operator-sdk@v0.5.0/hack/tests/test-subcommand.sh (about)

     1  #!/usr/bin/env bash
     2  source hack/lib/test_lib.sh
     3  
     4  set -ex
     5  
     6  pushd test/test-framework
     7  # test framework with defaults
     8  operator-sdk test local ./test/e2e
     9  
    10  # test operator-sdk test flags
    11  operator-sdk test local ./test/e2e --global-manifest deploy/crds/cache_v1alpha1_memcached_crd.yaml --namespaced-manifest deploy/namespace-init.yaml --go-test-flags "-parallel 1" --kubeconfig $HOME/.kube/config --image=quay.io/coreos/operator-sdk-dev:test-framework-operator-runtime
    12  
    13  # we use the test-memcached namespace for all future tests, so we only need to set this trap once
    14  kubectl create namespace test-memcached
    15  trap_add 'kubectl delete namespace test-memcached || true' EXIT
    16  operator-sdk test local ./test/e2e --namespace=test-memcached
    17  kubectl delete namespace test-memcached
    18  
    19  # test operator in up local mode
    20  kubectl create namespace test-memcached
    21  operator-sdk test local ./test/e2e --up-local --namespace=test-memcached
    22  kubectl delete namespace test-memcached
    23  
    24  # test operator in up local mode with kubeconfig
    25  kubectl create namespace test-memcached
    26  operator-sdk test local ./test/e2e --up-local --namespace=test-memcached --kubeconfig $HOME/.kube/config
    27  kubectl delete namespace test-memcached
    28  
    29  # test operator in no-setup mode
    30  kubectl create namespace test-memcached
    31  kubectl create -f deploy/crds/cache_v1alpha1_memcached_crd.yaml
    32  # this runs after the popd at the end, so it needs the path from the project root
    33  trap_add 'kubectl delete -f test/test-framework/deploy/crds/cache_v1alpha1_memcached_crd.yaml' EXIT
    34  kubectl create -f deploy/service_account.yaml --namespace test-memcached
    35  kubectl create -f deploy/role.yaml --namespace test-memcached
    36  kubectl create -f deploy/role_binding.yaml --namespace test-memcached
    37  kubectl create -f deploy/operator.yaml --namespace test-memcached
    38  operator-sdk test local ./test/e2e --namespace=test-memcached --no-setup
    39  kubectl delete namespace test-memcached
    40  popd