7
7
import osgtest .library .core as core
8
8
import osgtest .library .osgunittest as osgunittest
9
9
10
- class TestFetchCrl (osgunittest .OSGTestCase ):
11
-
10
+ def output_is_acceptable (fetch_crl_output ):
11
+ """All lines output from fetch-crl are considered an error. We whitelist
12
+ a few transient ones.
13
+ """
12
14
error_message_whitelist = [
13
15
'CRL has lastUpdate time in the future' ,
14
16
'CRL has nextUpdate time in the past' ,
@@ -28,24 +30,23 @@ class TestFetchCrl(osgunittest.OSGTestCase):
28
30
'LWP::Protocol::http::Socket' ,
29
31
]
30
32
31
- def output_is_acceptable (self , fetch_crl_output ):
32
- """All lines output from fetch-crl are considered an error. We whitelist
33
- a few transient ones.
34
- """
35
- all_lines_ok = True
36
- for line in fetch_crl_output .rstrip ('\n ' ).split ('\n ' ):
37
- if not line : # skip blank lines
38
- continue
39
- line_ok = False
40
- for error_string in TestFetchCrl .error_message_whitelist :
41
- if re .search (error_string , line ):
42
- line_ok = True
43
- break
44
- if not line_ok :
45
- all_lines_ok = False
46
- core .log_message ("Found uncaught error message: '%s'" % line .strip ())
33
+ all_lines_ok = True
34
+ for line in fetch_crl_output .rstrip ('\n ' ).split ('\n ' ):
35
+ if not line : # skip blank lines
36
+ continue
37
+ line_ok = False
38
+ for error_string in error_message_whitelist :
39
+ if re .search (error_string , line ):
40
+ line_ok = True
47
41
break
48
- return all_lines_ok
42
+ if not line_ok :
43
+ all_lines_ok = False
44
+ core .log_message ("Found uncaught error message: '%s'" % line .strip ())
45
+ break
46
+ return all_lines_ok
47
+
48
+
49
+ class TestFetchCrl (osgunittest .OSGTestCase ):
49
50
50
51
def test_01_fetch_crl (self ):
51
52
core .skip_ok_unless_installed ('fetch-crl' )
@@ -57,7 +58,7 @@ def test_01_fetch_crl(self):
57
58
status , stdout , stderr = core .system (command )
58
59
fail = core .diagnose ('Run %s in /etc' % 'fetch-crl' , command , status , stdout , stderr )
59
60
if status == 1 :
60
- self .assert_ (self . output_is_acceptable (stdout ), fail )
61
+ self .assert_ (output_is_acceptable (stdout ), fail )
61
62
else :
62
63
self .assertEquals (status , 0 , fail )
63
64
count = len (glob .glob (os .path .join ('/etc/grid-security/certificates' , '*.r[0-9]' )))
@@ -74,7 +75,7 @@ def test_02_fetch_crl_dir(self):
74
75
status , stdout , stderr = core .system (command )
75
76
fail = core .diagnose ('Run fetch-crl in temp dir' , command , status , stdout , stderr )
76
77
if status == 1 :
77
- self .assert_ (self . output_is_acceptable (stdout ), fail )
78
+ self .assert_ (output_is_acceptable (stdout ), fail )
78
79
else :
79
80
self .assertEquals (status , 0 , fail )
80
81
count = len (glob .glob (os .path .join (temp_crl_dir , '*.r[0-9]' )))
0 commit comments