@@ -5,7 +5,7 @@ import "testing"
55func TestUmamiV2StandbyBindsLivePhysicalReplayAndCopies (t * testing.T ) {
66 const standby = "umami-db-4"
77 storage := newRecoveredStorageFixture (t )
8- for _ , fault := range []string {"" , "old engine" , "incomplete copies" , "behind" , "primary" , "wrong mount" } {
8+ for _ , fault := range []string {"" , "retained peer" , "missing healthy peer" , "missing retention witness" , "retained peer behind" , " old engine" , "incomplete copies" , "behind" , "primary" , "wrong mount" } {
99 t .Run (fault , func (t * testing.T ) {
1010 f := storage .copyBindingObjects (t )
1111 obs := umamiV2TransitionObservation (t )
@@ -24,11 +24,22 @@ func TestUmamiV2StandbyBindsLivePhysicalReplayAndCopies(t *testing.T) {
2424 volumeRef ["pvcName" ], volumeRef ["namespace" ] = standby , "umami"
2525
2626 switch fault {
27+ case "retained peer" , "missing healthy peer" , "missing retention witness" , "retained peer behind" :
28+ obs .retainedStandby = "umami-db-2"
29+ status := valueObject (obs .Cluster , "status" )
30+ status ["instances" ] = float64 (3 )
31+ status ["healthyPVC" ] = []any {"umami-db-1" , "umami-db-3" , standby }
32+ }
33+ switch fault {
34+ case "missing healthy peer" :
35+ valueObject (obs .Cluster , "status" )["healthyPVC" ] = []any {"umami-db-1" , obs .retainedStandby , standby }
36+ case "missing retention witness" :
37+ obs .retainedStandby = ""
2738 case "old engine" :
2839 valueObject (f .engine , "spec" )["dataEngine" ] = "v1"
2940 case "incomplete copies" :
3041 f .replicas = f .replicas [:2 ]
31- case "behind" :
42+ case "behind" , "retained peer behind" :
3243 state := obs .States [standby ]
3344 state .ReplayLSN = "2/FF"
3445 obs .States [standby ] = state
@@ -38,7 +49,7 @@ func TestUmamiV2StandbyBindsLivePhysicalReplayAndCopies(t *testing.T) {
3849 value (pod , "spec" , "volumes" ).([]any )[0 ].(object )["persistentVolumeClaim" ] = object {"claimName" : "another-claim" }
3950 }
4051 got , err := bindUmamiV2Standby (obs , f .claim , f .pv , f .volume , f .engine , f .replicas , f .p .record .Storage .Disks )
41- if fault == "" {
52+ if fault == "" || fault == "retained peer" {
4253 if err != nil || got .Pod != benchmarkIdentity (pod ) || got .Claim != benchmarkIdentity (f .claim ) || len (got .Replicas ) != 3 {
4354 t .Fatalf ("V2 standby did not qualify: %+v, %v" , got , err )
4455 }
0 commit comments