Skip to content

Commit

Permalink
Flatten the 'db' commands, e.g. 'db prefix' to 'db/prefix'
Browse files Browse the repository at this point in the history
The user experience with commands that have sub-commands is not great
and it makes it harder to implement completion in 'cilium-dbg shell'
if we so choose. There isn't really any good rational for nesting
the commands like this, so let's go with Plan 9 style command names
(https://9p.io/magic/man2html/8/auth), e.g. "db prefix" becomes
"db/prefix".

Signed-off-by: Jussi Maki <[email protected]>
  • Loading branch information
joamaki committed Nov 14, 2024
1 parent cafbbe7 commit b94aa80
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 227 deletions.
26 changes: 13 additions & 13 deletions reconciler/testdata/batching.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,38 @@ start-reconciler with-batchops
# From here this is the same as incremental.txtar.

# Step 1: Insert non-faulty objects
db insert test-objects obj1.yaml
db insert test-objects obj2.yaml
db insert test-objects obj3.yaml
db cmp test-objects step1+3.table
db/insert test-objects obj1.yaml
db/insert test-objects obj2.yaml
db/insert test-objects obj3.yaml
db/cmp test-objects step1+3.table
expect-ops update(1) update(2) update(3)

# Reconciler should be running and reporting health
health 'job-reconcile.*level=OK.*message=OK, 3 object'

# Step 2: Update object '1' to be faulty and check that it fails and is being
# retried.
db insert test-objects obj1_faulty.yaml
db/insert test-objects obj1_faulty.yaml
expect-ops 'update(1) fail' 'update(1) fail'
db cmp test-objects step2.table
db/cmp test-objects step2.table
health 'job-reconcile.*level=Degraded.*1 error'

# Step 3: Set object '1' back to healthy state
db insert test-objects obj1.yaml
db/insert test-objects obj1.yaml
expect-ops 'update(1)'
db cmp test-objects step1+3.table
db/cmp test-objects step1+3.table
health 'job-reconcile.*level=OK'

# Step 4: Delete '1' and '2'
db delete test-objects obj1.yaml
db delete test-objects obj2.yaml
db cmp test-objects step4.table
db/delete test-objects obj1.yaml
db/delete test-objects obj2.yaml
db/cmp test-objects step4.table
expect-ops 'delete(1)' 'delete(2)'

# Step 5: Try to delete '3' with faulty target
set-faulty true
db delete test-objects obj3.yaml
db cmp test-objects empty.table
db/delete test-objects obj3.yaml
db/cmp test-objects empty.table
expect-ops 'delete(3) fail'
health 'job-reconcile.*level=Degraded.*1 error'

Expand Down
28 changes: 14 additions & 14 deletions reconciler/testdata/incremental.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@ hive start
start-reconciler

# Step 1: Insert non-faulty objects
db insert test-objects obj1.yaml
db insert test-objects obj2.yaml
db insert test-objects obj3.yaml
db cmp test-objects step1+3.table
db/insert test-objects obj1.yaml
db/insert test-objects obj2.yaml
db/insert test-objects obj3.yaml
db/cmp test-objects step1+3.table
expect-ops update(1) update(2) update(3)

# Reconciler should be running and reporting health
health 'job-reconcile.*level=OK.*message=OK, 3 object'

# Step 2: Update object '1' to be faulty and check that it fails and is being
# retried.
db insert test-objects obj1_faulty.yaml
db cmp test-objects step2.table
db/insert test-objects obj1_faulty.yaml
db/cmp test-objects step2.table
expect-ops 'update(1) fail' 'update(1) fail'
health 'job-reconcile.*level=Degraded.*1 error'

# Step 3: Set object '1' back to healthy state
db insert test-objects obj1.yaml
db show test-objects
db cmp test-objects step1+3.table
db/insert test-objects obj1.yaml
db/show test-objects
db/cmp test-objects step1+3.table
expect-ops 'update(1)'
health 'job-reconcile.*level=OK'

# Step 4: Delete '1' and '2'
db delete test-objects obj1.yaml
db delete test-objects obj2.yaml
db cmp test-objects step4.table
db/delete test-objects obj1.yaml
db/delete test-objects obj2.yaml
db/cmp test-objects step4.table
expect-ops 'delete(1)' 'delete(2)'

# Step 5: Try to delete '3' with faulty target
set-faulty true
db delete test-objects obj3.yaml
db cmp test-objects empty.table
db/delete test-objects obj3.yaml
db/cmp test-objects empty.table
expect-ops 'delete(3) fail'
health 'job-reconcile.*level=Degraded.*1 error'

Expand Down
8 changes: 4 additions & 4 deletions reconciler/testdata/pruning.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ hive start
start-reconciler with-prune

# Pruning without table being initialized does nothing.
db insert test-objects obj1.yaml
db/insert test-objects obj1.yaml
expect-ops update(1)
prune
db insert test-objects obj2.yaml
db/insert test-objects obj2.yaml
expect-ops update(2) update(1)
health 'job-reconcile.*level=OK'

Expand Down Expand Up @@ -33,12 +33,12 @@ expvar
grep 'prune_current_errors.test: 0'

# Delete an object and check pruning happens without it
db delete test-objects obj1.yaml
db/delete test-objects obj1.yaml
prune
expect-ops 'prune(n=1)' delete(1)

# Prune without objects
db delete test-objects obj2.yaml
db/delete test-objects obj2.yaml
prune
expect-ops prune(n=0) delete(2) prune(n=1)

Expand Down
14 changes: 7 additions & 7 deletions reconciler/testdata/refresh.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ hive start
start-reconciler with-refresh

# Step 1: Add a test object.
db insert test-objects obj1.yaml
db/insert test-objects obj1.yaml
expect-ops 'update(1)'
db cmp test-objects step1.table
db/cmp test-objects step1.table

# Step 2: Set the object as updated in the past to force refresh
db insert test-objects obj1_old.yaml
db/insert test-objects obj1_old.yaml
expect-ops 'update-refresh(1)'

# Step 3: Refresh with faulty target, should see fail & retries
set-faulty true
db insert test-objects obj1_old.yaml
db/insert test-objects obj1_old.yaml
expect-ops 'update-refresh(1) fail' 'update-refresh(1) fail'
db cmp test-objects step3.table
db/cmp test-objects step3.table
health
health 'job-reconcile.*Degraded'

# Step 4: Back to health
set-faulty false
db insert test-objects obj1_old.yaml
db/insert test-objects obj1_old.yaml
expect-ops 'update-refresh(1)'
db cmp test-objects step4.table
db/cmp test-objects step4.table
health 'job-reconcile.*OK, 1 object'

# -----
Expand Down
Loading

0 comments on commit b94aa80

Please sign in to comment.