github.com/leverly/deis@v1.0.2/tests/bin/test-acceptance.sh (about)

     1  #!/bin/bash
     2  #
     3  # Preps a test environment and runs `make test-integration`
     4  # against artifacts produced from the current source tree
     5  #
     6  
     7  # fail on any command exiting non-zero
     8  set -eo pipefail
     9  
    10  # absolute path to current directory
    11  export THIS_DIR=$(cd $(dirname $0); pwd)
    12  
    13  # setup the test environment
    14  source $THIS_DIR/test-setup.sh
    15  
    16  # setup callbacks on process exit and error
    17  trap cleanup EXIT
    18  trap dump_logs ERR
    19  
    20  log_phase "Running documentation tests"
    21  
    22  # test building documentation
    23  make -C docs/ test
    24  
    25  log_phase "Building from current source tree"
    26  
    27  # build all docker images and client binaries
    28  make build
    29  
    30  # use the built client binaries
    31  export PATH=$DEIS_ROOT/deisctl:$DEIS_ROOT/client/dist:$PATH
    32  
    33  log_phase "Running unit and functional tests"
    34  
    35  make test-components
    36  
    37  log_phase "Provisioning 3-node CoreOS"
    38  
    39  export DEIS_NUM_INSTANCES=3
    40  make discovery-url
    41  vagrant up --provider virtualbox
    42  
    43  log_phase "Waiting for etcd/fleet"
    44  
    45  until deisctl list >/dev/null 2>&1; do
    46      sleep 1
    47  done
    48  
    49  log_phase "Provisioning Deis on old release"
    50  
    51  function set_release {
    52    deisctl config $1 set image=deis/$1:$2
    53  }
    54  set_release logger ${OLD_TAG}
    55  set_release cache ${OLD_TAG}
    56  set_release router ${OLD_TAG}
    57  set_release database ${OLD_TAG}
    58  set_release controller ${OLD_TAG}
    59  set_release registry ${OLD_TAG}
    60  
    61  deisctl install platform
    62  time deisctl start platform
    63  
    64  log_phase "Running smoke tests"
    65  
    66  time make test-smoke
    67  
    68  log_phase "Publishing new release"
    69  
    70  time make release
    71  
    72  log_phase "Updating channel with new release"
    73  
    74  updateservicectl channel update --app-id=${APP_ID} --channel=${CHANNEL} --version=${BUILD_TAG} --publish=true
    75  
    76  log_phase "Waiting for upgrade to complete"
    77  
    78  # configure platform settings
    79  deisctl config platform set domain=$DEIS_TEST_DOMAIN
    80  deisctl config platform set sshPrivateKey=$DEIS_TEST_SSH_KEY
    81  deisctl config platform channel=${CHANNEL} autoupdate=true
    82  
    83  function wait_for_update {
    84    set -x
    85    vagrant ssh $1 -c "journalctl -n 500 -u deis-updater.service -f" &
    86    pid_$1=$!
    87    vagrant ssh $1 -c "/bin/sh -c \"while [[ \"\$(cat /etc/deis-version)\" != \"${BUILD_TAG}\" ]]; do echo waiting for update to complete...; sleep 5; done\""
    88    kill $pid_$1
    89    set +x
    90  }
    91  
    92  wait_for_update deis-1 &
    93  update1=$!
    94  wait_for_update deis-2 &
    95  update2=$!
    96  wait_for_update deis-3 &
    97  update3=$!
    98  wait update1 update2 update3
    99  
   100  log_phase "Running end-to-end integration test"
   101  
   102  time make test-integration