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