MCPcopy
hub / github.com/nats-io/nats.go / TestDisableQueueGroup

Function TestDisableQueueGroup

micro/test/service_test.go:1871–1912  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1869}
1870
1871func TestDisableQueueGroup(t *testing.T) {
1872 s := RunServerOnPort(-1)
1873 defer s.Shutdown()
1874
1875 nc, err := nats.Connect(s.ClientURL())
1876 if err != nil {
1877 t.Fatalf("Expected to connect to server, got %v", err)
1878 }
1879 defer nc.Close()
1880 wg := sync.WaitGroup{}
1881
1882 // Create 5 service responders.
1883 config := micro.Config{
1884 Name: "CoolAddService",
1885 Version: "0.1.0",
1886 Description: "Add things together",
1887 Metadata: map[string]string{"basic": "metadata"},
1888 Endpoint: &micro.EndpointConfig{
1889 Subject: "svc.add",
1890 Handler: micro.HandlerFunc(func(r micro.Request) {
1891 r.Respond(nil)
1892 wg.Done()
1893 }),
1894 },
1895 QueueGroupDisabled: true,
1896 }
1897
1898 for range 10 {
1899 srv, err := micro.AddService(nc, config)
1900 if err != nil {
1901 t.Fatalf("Unexpected error: %v", err)
1902 }
1903 defer srv.Stop()
1904 }
1905 wg.Add(10)
1906 // Send a request to the service.
1907 if err = nc.PublishRequest("svc.add", "rply", []byte("req")); err != nil {
1908 t.Fatalf("Unexpected error: %v", err)
1909 }
1910 wg.Wait()
1911
1912}
1913
1914func TestEndpointPendingLimits(t *testing.T) {
1915 s := RunServerOnPort(-1)

Callers

nothing calls this directly

Calls 11

HandlerFuncFuncType · 0.92
AddServiceFunction · 0.92
ConnectMethod · 0.80
FatalfMethod · 0.80
RunServerOnPortFunction · 0.70
RespondMethod · 0.65
DoneMethod · 0.65
StopMethod · 0.65
AddMethod · 0.65
CloseMethod · 0.45
PublishRequestMethod · 0.45

Tested by

no test coverage detected