Revision 6c005975 qa/ganeti-qa.py

b/qa/ganeti-qa.py
130 130
                        color=colors.BLUE, mark="*")
131 131

  
132 132

  
133
def RunTestBlock(fn, *args, **kwargs):
134
  """Runs a block of tests after printing a header.
135

  
136
  """
137
  tstart = datetime.datetime.now()
138

  
139
  desc = _DescriptionOf(fn)
140

  
141
  print
142
  print _FormatHeader("BLOCK %s start %s" % (tstart, desc),
143
                      color=[colors.YELLOW, colors.BOLD], mark="v")
144

  
145
  try:
146
    return fn(*args, **kwargs)
147
  except Exception, e:
148
    print _FormatHeader("BLOCK FAILED %s: %s" % (desc, e),
149
                        color=[colors.RED, colors.BOLD])
150
    raise
151
  finally:
152
    tstop = datetime.datetime.now()
153
    tdelta = tstop - tstart
154
    print _FormatHeader("BLOCK %s time=%s %s" % (tstop, tdelta, desc),
155
                        color=[colors.MAGENTA, colors.BOLD], mark="^")
156

  
157

  
133 158
def RunEnvTests():
134 159
  """Run several environment tests.
135 160

  
......
821 846
  """
822 847
  rapi_user = "ganeti-qa"
823 848

  
824
  RunEnvTests()
849
  RunTestBlock(RunEnvTests)
825 850
  rapi_secret = SetupCluster(rapi_user)
826 851

  
827 852
  if qa_rapi.Enabled():
828 853
    # Load RAPI certificate
829 854
    qa_rapi.Setup(rapi_user, rapi_secret)
830 855

  
831
  RunClusterTests()
832
  RunOsTests()
856
  RunTestBlock(RunClusterTests)
857
  RunTestBlock(RunOsTests)
833 858

  
834 859
  RunTestIf("tags", qa_tags.TestClusterTags)
835 860

  
836
  RunCommonNodeTests()
837
  RunGroupListTests()
838
  RunGroupRwTests()
839
  RunNetworkTests()
861
  RunTestBlock(RunCommonNodeTests)
862
  RunTestBlock(RunGroupListTests)
863
  RunTestBlock(RunGroupRwTests)
864
  RunTestBlock(RunNetworkTests)
840 865

  
841 866
  # The master shouldn't be readded or put offline; "delay" needs a non-master
842 867
  # node to test
......
883 908
  for (conf_name, setup_conf_f, restore_conf_f) in config_list:
884 909
    if qa_config.TestEnabled(conf_name):
885 910
      oldconf = setup_conf_f()
886
      RunInstanceTests()
911
      RunTestBlock(RunInstanceTests)
887 912
      restore_conf_f(oldconf)
888 913

  
889 914
  pnode = qa_config.AcquireNode()
......
912 937

  
913 938
  RunTestIf("cluster-upgrade", qa_cluster.TestUpgrade)
914 939

  
915
  RunExclusiveStorageTests()
940
  RunTestBlock(RunExclusiveStorageTests)
916 941
  RunTestIf(["cluster-instance-policy", "instance-add-plain-disk"],
917 942
            TestIPolicyPlainInstance)
918 943

  
919
  RunCustomSshPortTests()
944
  RunTestBlock(RunCustomSshPortTests)
920 945

  
921 946
  RunTestIf(
922 947
    "instance-add-restricted-by-disktemplates",
......
941 966
      snode.Release()
942 967
    qa_cluster.AssertClusterVerify()
943 968

  
944
  RunMonitoringTests()
969
  RunTestBlock(RunMonitoringTests)
945 970

  
946 971
  RunTestIf("create-cluster", qa_node.TestNodeRemoveAll)
947 972

  

Also available in: Unified diff