MCPcopy
hub / github.com/redis/go-redis / TestVoidProcessorEdgeCases

Function TestVoidProcessorEdgeCases

push/push_test.go:801–830  ·  view source on GitHub ↗

TestVoidProcessorEdgeCases tests edge cases for void processor

(t *testing.T)

Source from the content-addressed store, hash-verified

799
800// TestVoidProcessorEdgeCases tests edge cases for void processor
801func TestVoidProcessorEdgeCases(t *testing.T) {
802 t.Run("VoidProcessorMultipleOperations", func(t *testing.T) {
803 processor := NewVoidProcessor()
804 handler := NewTestHandler("test")
805
806 // Multiple register attempts should all fail
807 for i := 0; i < 5; i++ {
808 err := processor.RegisterHandler(fmt.Sprintf("TEST_%d", i), handler, false)
809 if err == nil {
810 t.Errorf("VoidProcessor RegisterHandler should always return error")
811 }
812 }
813
814 // Multiple unregister attempts should all fail
815 for i := 0; i < 5; i++ {
816 err := processor.UnregisterHandler(fmt.Sprintf("TEST_%d", i))
817 if err == nil {
818 t.Errorf("VoidProcessor UnregisterHandler should always return error")
819 }
820 }
821
822 // Multiple get attempts should all return nil
823 for i := 0; i < 5; i++ {
824 handler := processor.GetHandler(fmt.Sprintf("TEST_%d", i))
825 if handler != nil {
826 t.Errorf("VoidProcessor GetHandler should always return nil")
827 }
828 }
829 })
830}
831
832// Helper functions to create fake RESP3 protocol data for testing
833

Callers

nothing calls this directly

Calls 6

RegisterHandlerMethod · 0.95
UnregisterHandlerMethod · 0.95
GetHandlerMethod · 0.95
NewVoidProcessorFunction · 0.85
NewTestHandlerFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected