Belle II Software  release-08-01-10
TestMergeStaging Class Reference
Inheritance diagram for TestMergeStaging:
Collaboration diagram for TestMergeStaging:

Public Member Functions

def make_payloads (self, start_revision=1, **payloads)
 
def create_payloads_from_text (self, text)
 
def make_mock_db (self, running_state="RUNNING", staging_state="VALIDATED", running_payloads=None, staging_payloads=None)
 
def parse_operations (self, operations)
 
def test_states (self)
 
def test_overlaps (self)
 
def test_gaps (self)
 
def test_closed (self)
 
def test_start_early (self)
 
def test_simple_mode (self)
 
def test_running_check (self)
 
def test_operations_simple (self)
 
def test_operations_full (self)
 
def test_operations_ragged (self)
 
def test_operations_extend (self)
 
def test_operations_fix_open (self)
 
def test_merge_overlapandgaps (self)
 
def test_doc_example (self)
 
def test_doc_example_full (self)
 
def test_doc_example_fixclosed (self)
 

Static Public Attributes

dictionary RUNNING_BASE
 Basic definition of a running tag to be used later. More...
 

Detailed Description

Test the class to calculate updates to running tags

Definition at line 20 of file test_runningupdate.py.

Member Function Documentation

◆ create_payloads_from_text()

def create_payloads_from_text (   self,
  text 
)
Create payloads from a plain text list of payloads in the form of

payloadN, rev i, valid from a,b to c,d

Return a list of lists of payloads where each block of payload definitions
without empty lines in between is returned as one list.

Definition at line 49 of file test_runningupdate.py.

49  def create_payloads_from_text(self, text):
50  """
51  Create payloads from a plain text list of payloads in the form of
52 
53  payloadN, rev i, valid from a,b to c,d
54 
55  Return a list of lists of payloads where each block of payload definitions
56  without empty lines in between is returned as one list.
57  """
58  payloads = []
59  all_payloads = []
60  for match in re.findall(r'^\s*(payload\d+), rev (\d+), valid from (\d+),(\d+) to ([0-9-]+),([0-9-]+)$|^\s*$', text, re.M):
61  if not match[0]:
62  if payloads:
63  all_payloads.append(payloads)
64  payloads = []
65  continue
66  payloads.append(conditions_db.PayloadInformation(
67  0, match[0], int(match[1]), None, None, None, None, tuple(map(int, match[2:]))
68  ))
69 
70  if payloads:
71  all_payloads.append(payloads)
72 
73  return all_payloads
74 

◆ make_mock_db()

def make_mock_db (   self,
  running_state = "RUNNING",
  staging_state = "VALIDATED",
  running_payloads = None,
  staging_payloads = None 
)
Create a mock object that behaves close enough to the ConditionsDB class but returns
fixed values for the globaltags "running" and "staging" for testing

Definition at line 75 of file test_runningupdate.py.

◆ make_payloads()

def make_payloads (   self,
  start_revision = 1,
**  payloads 
)
Create a list of payloads from all keyword arguments Name of the
payloads will be the name of the argument, revision will increase
monotonic starting at start_revision for each argument and the iovs are
the values of the the argument.

To create a list with two payloads, A and B with two validities for B
and one for A one could use::

    make_payloads(A=[(0,0,1,2)], B=[(1,2,3,4), (3,5,6,7)])

Definition at line 32 of file test_runningupdate.py.

◆ parse_operations()

def parse_operations (   self,
  operations 
)
Parse the operations into a single list of [operation type, name,
revision, iov] for each operation

Definition at line 100 of file test_runningupdate.py.

◆ test_closed()

def test_closed (   self)
Test that we get errors on iovs not being open in the staging

Definition at line 177 of file test_runningupdate.py.

◆ test_doc_example()

def test_doc_example (   self)
Extract the example from the `b2conditionsdb tag runningupdate` docstring and run it

Definition at line 421 of file test_runningupdate.py.

◆ test_doc_example_fixclosed()

def test_doc_example_fixclosed (   self)
Extract the example from the `b2conditionsdb tag runningupdate` docstring and run it

Definition at line 474 of file test_runningupdate.py.

◆ test_doc_example_full()

def test_doc_example_full (   self)
Extract the example from the `b2conditionsdb tag runningupdate` docstring and run it

Definition at line 454 of file test_runningupdate.py.

◆ test_gaps()

def test_gaps (   self)
Test that we get errors for gaps in the staging

Definition at line 162 of file test_runningupdate.py.

◆ test_merge_overlapandgaps()

def test_merge_overlapandgaps (   self)
Test that merging fails if we have gaps or overlaps

Definition at line 406 of file test_runningupdate.py.

◆ test_operations_extend()

def test_operations_extend (   self)
If the staging payloads have same revision as the last one in running merge them

Definition at line 359 of file test_runningupdate.py.

◆ test_operations_fix_open()

def test_operations_fix_open (   self)
Test automatic opening of the last iov if necessary

Definition at line 383 of file test_runningupdate.py.

◆ test_operations_full()

def test_operations_full (   self)
In full mode we close B even if there's nothing in the staging tag
to allow "removing" payloads from the set of valid ones

Definition at line 316 of file test_runningupdate.py.

◆ test_operations_ragged()

def test_operations_ragged (   self)
This time B doesn't start on the spot but a bit later. And A is a list of iovs to be preserved

Definition at line 337 of file test_runningupdate.py.

◆ test_operations_simple()

def test_operations_simple (   self)
Test something useful.

Definition at line 296 of file test_runningupdate.py.

◆ test_overlaps()

def test_overlaps (   self)
Test that we get errors on overlaps in the staging

Definition at line 125 of file test_runningupdate.py.

◆ test_running_check()

def test_running_check (   self)
Test that we get errors on iovs not being open in the staging

Definition at line 275 of file test_runningupdate.py.

◆ test_simple_mode()

def test_simple_mode (   self)
Test that we only allow trivial iovs in simple mode

Definition at line 237 of file test_runningupdate.py.

◆ test_start_early()

def test_start_early (   self)
Test that we get errors if the payloads in the staging tag start too early

Definition at line 200 of file test_runningupdate.py.

◆ test_states()

def test_states (   self)
Test that we get errors if the tags don't exist or are in the wrong state

Definition at line 105 of file test_runningupdate.py.

Member Data Documentation

◆ RUNNING_BASE

dictionary RUNNING_BASE
static
Initial value:
= {
# gapless payload with different revisions
"A": [(0, 0, 0, -1), (1, 0, 1, 10), (1, 11, 1, 11), (1, 12, -1, -1)],
# simple open payload
"B": [(0, 0, -1, -1)],
# simple closed payload
"C": [(0, 0, 0, -1)],
}

Basic definition of a running tag to be used later.

Definition at line 23 of file test_runningupdate.py.


The documentation for this class was generated from the following file: