|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# Copyright (C) 2015 Red Hat, Inc. |
| 4 | +# |
| 5 | +# This copyrighted material is made available to anyone wishing to use, |
| 6 | +# modify, copy, or redistribute it subject to the terms and conditions of |
| 7 | +# the GNU General Public License v.2, or (at your option) any later version. |
| 8 | +# This program is distributed in the hope that it will be useful, but WITHOUT |
| 9 | +# ANY WARRANTY expressed or implied, including the implied warranties of |
| 10 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 11 | +# Public License for more details. You should have received a copy of the |
| 12 | +# GNU General Public License along with this program; if not, write to the |
| 13 | +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 14 | +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the |
| 15 | +# source code or documentation are not subject to the GNU General Public |
| 16 | +# License and may only be used or replicated with the express permission of |
| 17 | +# Red Hat, Inc. |
| 18 | + |
| 19 | +# Ignore unused variable parsed out by tooling scripts as test tags metadata |
| 20 | +# shellcheck disable=SC2034 |
| 21 | +TESTTYPE="method ftp proxy" |
| 22 | + |
| 23 | +. ${KSTESTDIR}/functions.sh |
| 24 | + |
| 25 | +kernel_args() { |
| 26 | + proxy_url="$(cat ${tmpdir}/proxy_url)" |
| 27 | + echo ${DEFAULT_BOOTOPTS} inst.proxy=${proxy_url} |
| 28 | +} |
| 29 | + |
| 30 | +prepare() { |
| 31 | + ks=$1 |
| 32 | + tmpdir=$2 |
| 33 | + |
| 34 | + # Start a proxy server |
| 35 | + start_proxy ${tmpdir}/proxy |
| 36 | + |
| 37 | + cp ${ks} ${tmpdir}/kickstart.ks |
| 38 | + echo ${tmpdir}/kickstart.ks |
| 39 | +} |
| 40 | + |
| 41 | +validate() { |
| 42 | + tmpdir=$1 |
| 43 | + validate_RESULT $tmpdir |
| 44 | + if [ ! -f $tmpdir/RESULT ]; then |
| 45 | + return 1 |
| 46 | + fi |
| 47 | + |
| 48 | + grep -q "$KSTEST_FTP_URL" $tmpdir/proxy/access.log |
| 49 | + if [[ $? -ne 0 ]]; then |
| 50 | + echo 'FTP URL server request was not proxied' >> $tmpdir/RESULT |
| 51 | + fi |
| 52 | + |
| 53 | + # check for .treeinfo request |
| 54 | + grep -q '\.treeinfo[[:space:]]' $tmpdir/proxy/access.log |
| 55 | + if [[ $? -ne 0 ]]; then |
| 56 | + echo '.treeinfo request to repository server was not proxied' >> $tmpdir/RESULT |
| 57 | + fi |
| 58 | + |
| 59 | + check_result_file "$tmpdir" |
| 60 | +} |
0 commit comments