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

Function TestDisableVserver

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

Source from the content-addressed store, hash-verified

640}
641
642func TestDisableVserver(t *testing.T) {
643 vserver := newTestVserver(nil)
644 vserver.handleConfigUpdate(&vserverConfig)
645
646 // Bring everything up.
647 for _, c := range vserver.checks {
648 n := &checkNotification{key: c.key, status: statusHealthy}
649 vserver.handleCheckNotification(n)
650 }
651 // Make sure the services are active.
652 if len(vserver.services) != len(expectedServices) {
653 t.Errorf("Expected %d services, got %d",
654 len(expectedServices), len(vserver.services))
655 return
656 }
657 for _, err := range checkAllUp(vserver) {
658 t.Error(err)
659 }
660
661 // Disable the vserver. Use a copy of the config so other tests are not
662 // affected.
663 disabledVserver := vserverConfig
664 disabledVserver.Enabled = false
665 vserver.handleConfigUpdate(&disabledVserver)
666
667 // The vserver should still have the same number of services.
668 if len(vserver.services) != len(expectedServices) {
669 t.Errorf("Expected %d services, got %d",
670 len(expectedServices), len(vserver.services))
671 return
672 }
673
674 // All services and VIPs should be down.
675 for _, err := range checkAllDown(vserver) {
676 t.Error(err)
677 }
678
679 // Healthchecks should have no effect.
680 for _, c := range vserver.checks {
681 n := &checkNotification{key: c.key, status: statusHealthy}
682 vserver.handleCheckNotification(n)
683 }
684 for _, err := range checkAllDown(vserver) {
685 t.Error(err)
686 }
687}
688
689func TestVserverOverride(t *testing.T) {
690 vserver := newTestVserver(nil)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected