Belle II Software  release-05-02-19
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 12 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 41 of file test_runningupdate.py.

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

◆ 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 67 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 24 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 92 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 169 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 412 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 467 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 445 of file test_runningupdate.py.

◆ test_gaps()

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

Definition at line 154 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 397 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 350 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 374 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 307 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 328 of file test_runningupdate.py.

◆ test_overlaps()

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

Definition at line 117 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 267 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 229 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 192 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 97 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 15 of file test_runningupdate.py.


The documentation for this class was generated from the following file:
conditions_db.PayloadInformation
Definition: __init__.py:49