"""
<Program Name>
  test_time_servers_running.py

<Started>
  Jul 26, 2009

<Author>
  Eric Kimbrel

<Purpose>
  Send out emails if fewer than 8 timeservers are running
"""

import sys
import send_gmail
import integrationtestlib

# use repy helper to bring in advertise.repy
import repyhelper
repyhelper.translate_and_import('advertise.repy')

def main():
  # initialize the gmail module
  success,explanation_str = send_gmail.init_gmail()
  if not success:
    integrationtestlib.log(explanation_str)
    sys.exit(0)

  #add Eric Kimbrel to the email notify list
  integrationtestlib.notify_list.append("lekimbrel@gmail.com")
  
  integrationtestlib.log("Looking up time_servers")  

  # verify that there are at least 8 time servers running
  servers = centralizedadvertise_lookup("time_server")
  if len(servers) < 8:
    integrationtestlib.log('WARNING: only '+str(len(servers))+' timeservers are running!')
    
    integrationtestlib.notify('WARNING: test_time_servers_running.py FAILED, only '+str(len(servers))+' timeservers are running!', "test_time_servers_running test failed")
  
  integrationtestlib.log("Finished looking up test servers... Test Passed")
  print "........................................................\n"

if __name__ == '__main__':
  main()

@@ -222,16 +222,33 @@
 ntestlib
+%0Aimport traceback
 %0A%0A# use 
@@ -637,24 +637,33 @@
 il.com%22)%0A  %0A
+  try:%0A  
   integratio
@@ -705,14 +705,14 @@
 rs%22)
-  
 %0A%0A  
+ 
+ 
 # ve
@@ -763,16 +763,18 @@
 running%0A
+  
   server
@@ -781,19 +781,8 @@
 s = 
-centralized
 adve
@@ -809,16 +809,18 @@
 erver%22)%0A
+  
   if len
@@ -834,16 +834,18 @@
 s) %3C 8:%0A
+  
     inte
@@ -932,24 +932,26 @@
 ')%0A    %0A    
+  
 integrationt
@@ -1109,16 +1109,18 @@
 ed%22)%0A  %0A
+  
   integr
@@ -1187,16 +1187,18 @@
 assed%22)%0A
+  
   print 
@@ -1257,16 +1257,168 @@
 .....%5Cn%22
+%0A  except:%0A    integrationtestlib.notify(%22Test failed for an unknown reason:%5Cn%22 +%0A      traceback.format_exc(), %22test_time_servers_running test failed%22)
 %0A%0Aif __n

Make time integration test more robust * All errors that occur after e-mail notification will cause an error e-mail to be sent to developers * Fix for #1284