github.com/cilium/statedb@v0.3.2/reconciler/testdata/batching.txtar (about)

     1  # Test the incremental reconciliation with
     2  # batching.
     3  
     4  hive start
     5  start-reconciler with-batchops
     6  
     7  # From here this is the same as incremental.txtar.
     8  
     9  # Step 1: Insert non-faulty objects
    10  db insert test-objects obj1.yaml
    11  db insert test-objects obj2.yaml
    12  db insert test-objects obj3.yaml
    13  db cmp test-objects step1+3.table
    14  expect-ops update(1) update(2) update(3)
    15  
    16  # Reconciler should be running and reporting health
    17  health 'job-reconcile.*level=OK.*message=OK, 3 object'
    18  
    19  # Step 2: Update object '1' to be faulty and check that it fails and is being
    20  # retried.
    21  db insert test-objects obj1_faulty.yaml
    22  expect-ops 'update(1) fail' 'update(1) fail' 
    23  db cmp test-objects step2.table
    24  health 'job-reconcile.*level=Degraded.*1 error'
    25  
    26  # Step 3: Set object '1' back to healthy state
    27  db insert test-objects obj1.yaml
    28  expect-ops 'update(1)'
    29  db cmp test-objects step1+3.table
    30  health 'job-reconcile.*level=OK'
    31  
    32  # Step 4: Delete '1' and '2'
    33  db delete test-objects obj1.yaml
    34  db delete test-objects obj2.yaml
    35  db cmp test-objects step4.table
    36  expect-ops 'delete(1)' 'delete(2)'
    37  
    38  # Step 5: Try to delete '3' with faulty target
    39  set-faulty true
    40  db delete test-objects obj3.yaml
    41  db cmp test-objects empty.table
    42  expect-ops 'delete(3) fail'
    43  health 'job-reconcile.*level=Degraded.*1 error'
    44  
    45  # Step 6: Set the target back to healthy
    46  set-faulty false
    47  expect-ops 'delete(3)'
    48  health 'job-reconcile.*level=OK.*message=OK, 0 object'
    49  
    50  # Check metrics
    51  expvar
    52  ! grep 'reconciliation_count.test: 0$'
    53  grep 'reconciliation_current_errors.test: 0$'
    54  ! grep 'reconciliation_total_errors.test: 0$'
    55  ! grep 'reconciliation_duration.test/update: 0$'
    56  ! grep 'reconciliation_duration.test/delete: 0$'
    57  
    58  # ------------
    59  
    60  -- empty.table --
    61  ID  StatusKind
    62  
    63  -- step1+3.table --
    64  ID  StatusKind StatusError
    65  1   Done
    66  2   Done
    67  3   Done
    68  
    69  -- step2.table --
    70  ID  StatusKind StatusError
    71  1   Error      update fail
    72  2   Done
    73  3   Done
    74  
    75  -- step4.table --
    76  ID  StatusKind
    77  3   Done
    78  
    79  -- step7.table --
    80  ID   Faulty   StatusKind   StatusError
    81  4    true     Error        update fail
    82  5    false    Done
    83  
    84  
    85  -- step8.table --
    86  ID   Faulty   StatusKind
    87  4    false    Done   
    88  5    false    Done
    89  
    90  
    91  -- obj1.yaml --
    92  id: 1
    93  faulty: false
    94  status:
    95      kind: Pending
    96  
    97  -- obj1_faulty.yaml --
    98  id: 1
    99  faulty: true
   100  status:
   101      kind: Pending
   102  
   103  -- obj2.yaml --
   104  id: 2
   105  faulty: false
   106  status:
   107      kind: Pending
   108  
   109  -- obj2_faulty.yaml --
   110  id: 2
   111  faulty: true
   112  status:
   113      kind: Pending
   114  
   115  -- obj3.yaml --
   116  id: 3
   117  faulty: false
   118  status:
   119      kind: Pending
   120  
   121  -- obj3_faulty.yaml --
   122  id: 3
   123  faulty: true
   124  status:
   125      kind: Pending
   126