#!/bin/bash

cvmfs_test_name="404 Proxy Failover"
cvmfs_test_suites="quick"

cvmfs_run_test() {
  logfile=$1
  local scratch_dir=$(pwd)

  local uuid1
  local uuid2

  uuid1=$(head -c10 /dev/urandom | sha1sum | awk '{print $1}')
  uuid2=$(head -c10 /dev/urandom | sha1sum | awk '{print $1}')

  echo "configure cvmfs with an unreachable proxy for the test case"
  cvmfs_mount "atlas.cern.ch" "CVMFS_HTTP_PROXY=http://$uuid1.cern.ch/cvmfsproxy:3128|http://$uuid2.cern.ch/proxy:3128|${CVMFS_TEST_PROXY}" || return 1

  ls /cvmfs/atlas.cern.ch || return 2
}
