Skip to content

Commit a2f5a1c

Browse files
author
milan k
committed
init skip test
1 parent 4f88cd6 commit a2f5a1c

10 files changed

+131
-109
lines changed

src/bugzilla/__init__.pyc

-36 Bytes
Binary file not shown.

src/bugzilla/base.pyc

-1.03 KB
Binary file not shown.

src/bugzilla/bugzilla3.pyc

-182 Bytes
Binary file not shown.

src/bugzilla/nvlbugzilla.pyc

-126 Bytes
Binary file not shown.

src/bugzilla/rhbugzilla.pyc

-387 Bytes
Binary file not shown.

src/bugzilla/util.pyc

912 Bytes
Binary file not shown.

src/image_validation.sh

+58-46
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,43 @@
1414
#
1515
# written by [email protected]
1616
# modified by [email protected] for RHEL 6
17+
1718

1819
FAILURES=0
1920
MEM_HWP=0
2021

22+
# try to pushd to a `valid' source tree
23+
[ -z $BASEDIR ] && BASEDIR=/root/valid/src
24+
[ -d $BASEDIR ] || BASEDIR=$PWD
25+
set -e
26+
pushd $BASEDIR
27+
source testlib.sh
28+
set +e
29+
30+
function list_tests(){
31+
# return the list of defined tests
32+
declare -F | cut -d\ -f3,3 | grep "^test_.*"
33+
}
34+
35+
function filter_tests(){
36+
# produces the list of tests to execute
37+
# args:
38+
# list of skip expressions to use with egrep
39+
# return:
40+
# list of passing function names
41+
42+
# @ is an identity element; hopefully, it won't ever match ;)
43+
local skip="@,${@}"
44+
skip="${skip%,}" # cut off trailing spaces; takes care of empty $@, too
45+
# convert the coma or space separated list to an expression of elements
46+
# separated by `|'
47+
shopt -s extglob
48+
skip="${skip//*([[:space:]])[,[:space:]]*([[:space:]])/|}"
49+
shopt -u extglob
50+
# figure out all test functions passing the skip list
51+
list_tests | egrep -v "${skip}"
52+
}
53+
2154
function usage()
2255
{
2356
echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! "
@@ -40,9 +73,12 @@ function usage()
4073
echo "--public-dns :: The Public-DNS Host name of the machine"
4174
echo "--ami-id :: The AMI ID"
4275
echo "--arch-id :: The Architecture i386 or x86_64 for the launched instance"
76+
echo "--skip-list :: A list of coma-separated expressions specifying test names
77+
to skip. A skip-list might contain:
78+
test_repos,test_yum_full_test,test_IPv6"
79+
echo "--list-tests :: list available tests"
4380
}
4481

45-
4682
#cli
4783
for i in $*
4884
do
@@ -86,14 +122,28 @@ for i in $*
86122
--arch-id=*)
87123
ARCH_ID="`echo $i | sed 's/[-a-zA-Z0-9]*=//'`"
88124
;;
125+
--skip-list=*)
126+
SKIP_LIST="${i#*=}"
127+
;;
128+
--list-tests)
129+
list_tests
130+
exit 0
131+
;;
132+
89133
*)
90-
# unknown option
134+
# unknown option
91135
usage
92136
exit 1
93137
;;
94138
esac
95139
done
96140

141+
# initialize testlib
142+
set -e
143+
set -x
144+
_testlib_init
145+
set +x
146+
set +e
97147

98148
if [[ -z $IMAGEID ]] || [[ -z $RHELV ]] || [[ -z $yum_test ]] || [[ -z $BUG_USERNAME ]] || [[ -z $BUG_PASSWORD ]] || [[ -z $MEM_HWP ]]; then
99149
usage
@@ -102,8 +152,6 @@ fi
102152

103153

104154

105-
pushd /root/valid/src
106-
source $PWD/testlib.sh
107155

108156
### DONT REMOVE OR COMMENT OUT ###
109157
echo "opening a bugzilla for logging purposes"
@@ -130,42 +178,12 @@ if [ $QUESTIONS == "no" ];then
130178
fi
131179
echo "##### START TESTS #####"
132180
echo ""
133-
test_uname
134-
test_disk_format
135-
test_disk_size
136-
[ ! -f /root/noswap ] && test_swap_file || echo "t1.micro doesn't require swap"
137-
test_selinux
138-
test_package_set
139-
test_verify_rpms
140-
test_gpg_keys
141-
#test_repos #remarking this out for now.. until additional repo's land. the yum tests should be sufficient
142-
test_yum_plugin
143-
if [ $yum_test == "yes" ];then
144-
test_yum_full_test
145-
else
146-
test_yum_general_test
147-
fi
148-
test_bash_history
149-
test_system_id
150-
test_cloud-firstboot
151-
test_nameserver
152-
test_group
153-
test_passwd
154-
test_inittab
155-
test_shells
156-
#test_IPv6 no longer needed
157-
test_networking
158-
test_iptables
159-
test_sshd
160-
test_chkconfig
161-
test_syslog
162-
test_auditd
163-
test_sshSettings
164-
test_libc6-xen.conf
165-
test_grub
166-
#installTestKernel
167-
test_resize2fs
168-
test_fetch_host_details
181+
# skip-list might contain
182+
# installTestKernel,test_repos,test_yum_full_test,test_IPv6,
183+
184+
for f in $( filter_tests $SKIP_LIST ) ; do
185+
$f
186+
done
169187

170188
### DONT REMOVE OR COMMENT OUT ###
171189
show_failures
@@ -182,9 +200,3 @@ echo "REBOOTING"
182200
reboot
183201
#im_exit
184202
##################################
185-
186-
187-
188-
189-
190-

src/testlib.sh

+48-38
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,50 @@
1414
#
1515
# written by [email protected]
1616
# modified by [email protected]
17-
18-
LOGFILE=$PWD/validate.log
19-
DLOG=" tee -a ${LOGFILE} " #Display and log output
20-
cat /dev/null > $LOGFILE
21-
RSLT=""
22-
LOGRESULT="echo ${RSLT} 1>>$LOGFILE 2>>$LOGFILE"
23-
DIFFDIR=$PWD
24-
SYSDATE=$( /bin/date '+%Y-%m-%d %H:%M' )
25-
UNAMEI=$( /bin/uname -i )
26-
BETA=0
27-
28-
29-
echo ""
30-
echo ""
31-
32-
txtred=$(tput setaf 1) # Red
33-
txtgrn=$(tput setaf 2) # Green
34-
txtrst=$(tput sgr0) # Text reset
35-
36-
### Begin: Create a list of partitions
37-
rm -Rf disk_partitions
38-
rm -Rf swap_partitions
39-
mount | grep ^/dev | awk '{print $1}' >> disk_partitions
40-
parted -l | grep -B 5 swap | grep ^Disk | awk '{print $2}' | sed '$s/.$//' >> swap_partitions
41-
42-
rm -Rf tmp1_partitions tmp2_partitions
43-
### End: Create a list of partitions
44-
45-
RHEL=`cat /etc/redhat-release | awk '{print $7}' | awk -F. '{print $1}'`
46-
RHELU=`cat /etc/redhat-release | awk '{print $7}' | awk -F. '{print $2}'`
47-
RHEL_FOUND=$RHEL.$RHELU
48-
KERNEL=""
49-
KERNEL_UPDATED=""
50-
TEST_CURRENT=""
51-
TEST_FAILED=""
52-
echo "IMAGE ID= ${IMAGEID}" >> $LOGFILE
53-
54-
17+
18+
19+
[ -n __TESTLIB__ ] && return 0
20+
__TESTLIB__=loaded
21+
22+
function _testlib_init(){
23+
[ -n $__TESTLIB_INIT__] && return 0
24+
LOGFILE=$PWD/validate.log
25+
DLOG=" tee -a ${LOGFILE} " #Display and log output
26+
cat /dev/null > $LOGFILE
27+
RSLT=""
28+
LOGRESULT="echo ${RSLT} 1>>$LOGFILE 2>>$LOGFILE"
29+
DIFFDIR=$PWD
30+
SYSDATE=$( /bin/date '+%Y-%m-%d %H:%M' )
31+
UNAMEI=$( /bin/uname -i )
32+
BETA=0
33+
34+
35+
echo ""
36+
echo ""
37+
38+
txtred=$(tput setaf 1) # Red
39+
txtgrn=$(tput setaf 2) # Green
40+
txtrst=$(tput sgr0) # Text reset
41+
42+
### Begin: Create a list of partitions
43+
rm -Rf disk_partitions
44+
rm -Rf swap_partitions
45+
mount | grep ^/dev | awk '{print $1}' >> disk_partitions
46+
parted -l | grep -B 5 swap | grep ^Disk | awk '{print $2}' | sed '$s/.$//' >> swap_partitions
47+
48+
rm -Rf tmp1_partitions tmp2_partitions
49+
### End: Create a list of partitions
50+
51+
RHEL=`cat /etc/redhat-release | awk '{print $7}' | awk -F. '{print $1}'`
52+
RHELU=`cat /etc/redhat-release | awk '{print $7}' | awk -F. '{print $2}'`
53+
RHEL_FOUND=$RHEL.$RHELU
54+
KERNEL=""
55+
KERNEL_UPDATED=""
56+
TEST_CURRENT=""
57+
TEST_FAILED=""
58+
echo "IMAGE ID= ${IMAGEID}" >> $LOGFILE
59+
__TESTLIB_INIT__=initialized
60+
}
5561

5662
function new_test()
5763
{
@@ -442,6 +448,10 @@ function test_bash_history()
442448

443449
function test_swap_file()
444450
{
451+
if [ -f /root/noswap ] ; then
452+
echo "/root/noswap present -- this machine doesn't require swap" >> $LOGFILE
453+
return 0
454+
fi
445455
new_test "## Verify turning on/off swap file ... "
446456
if [ $UNAMEI == "i386" ]; then
447457
swap=`cat swap_partitions`

src/validation.cfg

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
[SSH-Info]
2-
ssh-key-path_useast = /home/kbidarka/cloud-keyuseast-new.pem
3-
ssh-key-name_useast = cloud-keyuseast-new
4-
ssh-key-path_uswest = /home/kbidarka/cloud-keyuswest-new.pem
5-
ssh-key-name_uswest = cloud-keyuswest-new
6-
ssh-key-path_uswest-oregon = /home/kbidarka/cloud-keyuswest-oregon.pem
7-
ssh-key-name_uswest-oregon = cloud-keyuswest-oregon
8-
ssh-key-path_euwest = /home/kbidarka/cloud-keyeuwest-new.pem
9-
ssh-key-name_euwest = cloud-keyeuwest-new
10-
ssh-key-path_apnorth = /home/kbidarka/cloud-keyapnorth-new.pem
11-
ssh-key-name_apnorth = cloud-keyapnorth-new
12-
ssh-key-path_apsouth = /home/kbidarka/cloud-keyapsouth-new.pem
13-
ssh-key-name_apsouth = cloud-keyapsouth-new
2+
ssh-key-path_useast=/home/kbidarka/cloud-keyuseast-new.pem
3+
ssh-key-name_useast=cloud-keyuseast-new
4+
ssh-key-path_uswest=/home/kbidarka/cloud-keyuswest-new.pem
5+
ssh-key-name_uswest=cloud-keyuswest-new
6+
ssh-key-path_uswest-oregon=/home/kbidarka/cloud-keyuswest-oregon.pem
7+
ssh-key-name_uswest-oregon=cloud-keyuswest-oregon
8+
ssh-key-path_euwest=/home/kbidarka/cloud-keyeuwest-new.pem
9+
ssh-key-name_euwest=cloud-keyeuwest-new
10+
ssh-key-path_apnorth=/home/kbidarka/cloud-keyapnorth-new.pem
11+
ssh-key-name_apnorth=cloud-keyapnorth-new
12+
ssh-key-path_apsouth=/home/kbidarka/cloud-keyapsouth-new.pem
13+
ssh-key-name_apsouth=cloud-keyapsouth-new
1414

1515
[EC2-Keys]
16-
ec2-key =
17-
ec2-secret-key =
16+
ec2-key=
17+
ec2-secret-key=
1818

1919
[Bugzilla-Info]
20-
bugzilla_usr = [email protected]
21-
bugzilla_pwd =
20+
bugzilla_usr=[email protected]
21+
bugzilla_pwd=
2222

2323
[Misc-Info]
24-
csv = true
25-
git = false
26-
basedir = /home/kbidarka/full123/valid/src
24+
csv=true
25+
git=false
26+
basedir=/home/kbidarka/full123/valid/src

validate.spec

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
Name: validate
2-
Version: 6.1
2+
Version: 6.1
33
Release: 1
4-
Summary: Validates a cloud providers image of Red Hat Enterprise Linux
4+
Summary: Validates a cloud providers image of Red Hat Enterprise Linux
55

66
Group: Development/Libraries
77
License: GPL
8-
URL: http://github.com/weshayutin/valid
8+
URL: http://github.com/weshayutin/valid
99
Source0: %{name}-%{version}.tar.gz
1010
BuildRoot: %{_tmppath}/%{name}
1111
BuildArch: noarch
1212

13-
# BuildRequires:
14-
# Requires:
13+
# BuildRequires:
14+
# Requires:
1515

1616
%description
17-
A shell script that will run tests to validate that the image of Red Hat Enterprise Linux meets or exceeds the minimum requirements as defined by Red Hat.
17+
A shell script that will run tests to validate that the image of Red Hat Enterprise Linux meets or exceeds the minimum requirements as defined by Red Hat.
1818

1919

2020
%prep

0 commit comments

Comments
 (0)