Revision 5fa0375e qa/qa_rapi.py

b/qa/qa_rapi.py
44 44
import qa_error
45 45

  
46 46
from qa_utils import (AssertEqual, AssertIn, AssertMatch, StartLocalCommand)
47
from qa_utils import InstanceCheck, INST_DOWN, INST_UP, FIRST_ARG
47 48

  
48 49

  
49 50
_rapi_ca = None
......
349 350
        ])
350 351

  
351 352

  
353
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG)
352 354
def TestInstance(instance):
353 355
  """Testing getting instance(s) info via remote API.
354 356

  
......
577 579
    raise
578 580

  
579 581

  
582
@InstanceCheck(None, INST_DOWN, FIRST_ARG)
580 583
def TestRapiInstanceRemove(instance, use_client):
581 584
  """Test removing instance via RAPI"""
582 585
  if use_client:
......
591 594
  qa_config.ReleaseInstance(instance)
592 595

  
593 596

  
597
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG)
594 598
def TestRapiInstanceMigrate(instance):
595 599
  """Test migrating instance via RAPI"""
596 600
  # Move to secondary node
597 601
  _WaitForRapiJob(_rapi_client.MigrateInstance(instance["name"]))
602
  qa_utils.RunInstanceCheck(instance, True)
598 603
  # And back to previous primary
599 604
  _WaitForRapiJob(_rapi_client.MigrateInstance(instance["name"]))
600 605

  
601 606

  
607
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG)
602 608
def TestRapiInstanceFailover(instance):
603 609
  """Test failing over instance via RAPI"""
604 610
  # Move to secondary node
605 611
  _WaitForRapiJob(_rapi_client.FailoverInstance(instance["name"]))
612
  qa_utils.RunInstanceCheck(instance, True)
606 613
  # And back to previous primary
607 614
  _WaitForRapiJob(_rapi_client.FailoverInstance(instance["name"]))
608 615

  
609 616

  
617
@InstanceCheck(INST_UP, INST_DOWN, FIRST_ARG)
610 618
def TestRapiInstanceShutdown(instance):
611 619
  """Test stopping an instance via RAPI"""
612 620
  _WaitForRapiJob(_rapi_client.ShutdownInstance(instance["name"]))
613 621

  
614 622

  
623
@InstanceCheck(INST_DOWN, INST_UP, FIRST_ARG)
615 624
def TestRapiInstanceStartup(instance):
616 625
  """Test starting an instance via RAPI"""
617 626
  _WaitForRapiJob(_rapi_client.StartupInstance(instance["name"]))
618 627

  
619 628

  
629
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG)
620 630
def TestRapiInstanceRenameAndBack(rename_source, rename_target):
621 631
  """Test renaming instance via RAPI
622 632

  
......
625 635

  
626 636
  """
627 637
  _WaitForRapiJob(_rapi_client.RenameInstance(rename_source, rename_target))
638
  qa_utils.RunInstanceCheck(rename_source, False)
639
  qa_utils.RunInstanceCheck(rename_target, True)
628 640
  _WaitForRapiJob(_rapi_client.RenameInstance(rename_target, rename_source))
641
  qa_utils.RunInstanceCheck(rename_target, False)
629 642

  
630 643

  
644
@InstanceCheck(INST_DOWN, INST_DOWN, FIRST_ARG)
631 645
def TestRapiInstanceReinstall(instance):
632 646
  """Test reinstalling an instance via RAPI"""
633 647
  _WaitForRapiJob(_rapi_client.ReinstallInstance(instance["name"]))
634 648

  
635 649

  
650
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG)
636 651
def TestRapiInstanceReplaceDisks(instance):
637 652
  """Test replacing instance disks via RAPI"""
638 653
  _WaitForRapiJob(_rapi_client.ReplaceInstanceDisks(instance["name"],
......
641 656
    mode=constants.REPLACE_DISK_SEC, disks="0"))
642 657

  
643 658

  
659
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG)
644 660
def TestRapiInstanceModify(instance):
645 661
  """Test modifying instance via RAPI"""
646 662
  def _ModifyInstance(**kwargs):
......
663 679
    })
664 680

  
665 681

  
682
@InstanceCheck(INST_UP, INST_UP, FIRST_ARG)
666 683
def TestRapiInstanceConsole(instance):
667 684
  """Test getting instance console information via RAPI"""
668 685
  result = _rapi_client.GetInstanceConsole(instance["name"])
......
671 688
  AssertEqual(console.instance, qa_utils.ResolveInstanceName(instance["name"]))
672 689

  
673 690

  
691
@InstanceCheck(INST_DOWN, INST_DOWN, FIRST_ARG)
674 692
def TestRapiStoppedInstanceConsole(instance):
675 693
  """Test getting stopped instance's console information via RAPI"""
676 694
  try:
......
727 745
      si,
728 746
      ]
729 747

  
748
    qa_utils.RunInstanceCheck(di, False)
730 749
    AssertEqual(StartLocalCommand(cmd).wait(), 0)
750
    qa_utils.RunInstanceCheck(si, False)
751
    qa_utils.RunInstanceCheck(di, True)

Also available in: Unified diff