MCPcopy
hub / github.com/google/seesaw / TestVserverOverride

Function TestVserverOverride

engine/vserver_test.go:689–801  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

687}
688
689func TestVserverOverride(t *testing.T) {
690 vserver := newTestVserver(nil)
691 vserver.handleConfigUpdate(&vserverConfig)
692
693 // Bring everything up.
694 for _, c := range vserver.checks {
695 n := &checkNotification{key: c.key, status: statusHealthy}
696 vserver.handleCheckNotification(n)
697 }
698 // Make sure the services are active.
699 if len(vserver.services) != len(expectedServices) {
700 t.Errorf("Expected %d services, got %d",
701 len(expectedServices), len(vserver.services))
702 return
703 }
704 for _, err := range checkAllUp(vserver) {
705 t.Error(err)
706 }
707
708 // Disable the vserver with an Override.
709 var o seesaw.Override
710 o = &seesaw.VserverOverride{
711 VserverName: vserverConfig.Name,
712 OverrideState: seesaw.OverrideDisable,
713 }
714 vserver.handleOverride(o)
715
716 // The vserver should still have the same number of services.
717 if len(vserver.services) != len(expectedServices) {
718 t.Errorf("Expected %d services, got %d",
719 len(expectedServices), len(vserver.services))
720 return
721 }
722
723 // All services and VIPs should be down.
724 for _, err := range checkAllDown(vserver) {
725 t.Error(err)
726 }
727
728 // Healthchecks should have no effect.
729 for _, c := range vserver.checks {
730 n := &checkNotification{key: c.key, status: statusHealthy}
731 vserver.handleCheckNotification(n)
732 }
733 for _, err := range checkAllDown(vserver) {
734 t.Error(err)
735 }
736
737 // Bring it back.
738 o = &seesaw.VserverOverride{
739 VserverName: vserverConfig.Name,
740 OverrideState: seesaw.OverrideDefault,
741 }
742 vserver.handleOverride(o)
743 for _, c := range vserver.checks {
744 n := &checkNotification{key: c.key, status: statusHealthy}
745 vserver.handleCheckNotification(n)
746 }

Callers

nothing calls this directly

Calls 7

newTestVserverFunction · 0.85
checkAllUpFunction · 0.85
checkAllDownFunction · 0.85
handleConfigUpdateMethod · 0.45
ErrorMethod · 0.45
handleOverrideMethod · 0.45

Tested by

no test coverage detected