| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | package metrics
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import (
 | 
					
						
							| 
									
										
										
										
											2018-04-22 08:34:35 +01:00
										 |  |  | 	"context"
 | 
					
						
							| 
									
										
										
										
											2025-09-14 01:15:25 +03:00
										 |  |  | 	"io"
 | 
					
						
							| 
									
										
										
										
											2025-08-29 06:03:55 +03:00
										 |  |  | 	"net"
 | 
					
						
							| 
									
										
										
										
											2025-09-14 01:15:25 +03:00
										 |  |  | 	"net/http"
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 	"testing"
 | 
					
						
							| 
									
										
										
										
											2025-08-29 06:03:55 +03:00
										 |  |  | 	"time"
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-14 09:36:06 +01:00
										 |  |  | 	"github.com/coredns/coredns/plugin"
 | 
					
						
							| 
									
										
										
										
											2017-09-21 15:15:47 +01:00
										 |  |  | 	"github.com/coredns/coredns/plugin/pkg/dnstest"
 | 
					
						
							| 
									
										
										
										
											2017-09-14 09:36:06 +01:00
										 |  |  | 	"github.com/coredns/coredns/plugin/test"
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/miekg/dns"
 | 
					
						
							| 
									
										
										
										
											2025-09-14 01:15:25 +03:00
										 |  |  | 	"github.com/prometheus/client_golang/prometheus"
 | 
					
						
							|  |  |  | 	"github.com/prometheus/client_golang/prometheus/promauto"
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func TestMetrics(t *testing.T) {
 | 
					
						
							| 
									
										
										
										
											2017-12-13 16:59:10 -05:00
										 |  |  | 	met := New("localhost:0")
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 	if err := met.OnStartup(); err != nil {
 | 
					
						
							|  |  |  | 		t.Fatalf("Failed to start metrics handler: %s", err)
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							| 
									
										
										
										
											2018-04-21 17:43:02 +01:00
										 |  |  | 	defer met.OnFinalShutdown()
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	met.AddZone("example.org.")
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tests := []struct {
 | 
					
						
							| 
									
										
										
										
											2017-09-14 09:36:06 +01:00
										 |  |  | 		next          plugin.Handler
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 		qname         string
 | 
					
						
							|  |  |  | 		qtype         uint16
 | 
					
						
							|  |  |  | 		metric        string
 | 
					
						
							|  |  |  | 		expectedValue string
 | 
					
						
							|  |  |  | 	}{
 | 
					
						
							|  |  |  | 		// This all works because 1 bucket (1 zone, 1 type)
 | 
					
						
							|  |  |  | 		{
 | 
					
						
							|  |  |  | 			next:          test.NextHandler(dns.RcodeSuccess, nil),
 | 
					
						
							| 
									
										
											  
											
												Speed up testing (#4239)
* Speed up testing
* make notification run in the background, this recudes the test_readme
time from 18s to 0.10s
* reduce time for zone reload
* TestServeDNSConcurrent remove entirely. This took a whopping 58s for
  ... ? A few minutes staring didn't reveal wth it is actually testing.
  Making values smaller revealed race conditions in the tests. Remove
  entirely.
* Move many interval values to variables so we can reset them to short
  values for the tests.
* test_large_axfr: make the zone smaller. The number used 64K has no
  rational, make it 64/10 to speed up.
* TestProxyThreeWay: use client with shorter timeout
A few random tidbits in other tests.
Total time saved: 177s (almost 3m) - which makes it worthwhile again to
run the test locally:
this branch:
~~~
ok  	github.com/coredns/coredns/test	10.437s
cd plugin; time go t ./...
5,51s user 7,51s system 11,15s elapsed 744%CPU (
~~~
master:
~~~
ok  	github.com/coredns/coredns/test	35.252s
cd plugin; time go t ./...
157,64s user 15,39s system 50,05s elapsed 345%CPU ()
~~~
tests/ -25s
plugins/ -40s
This brings the total on 20s, and another 10s can be saved by fixing
dnstapio. Moving this to 5s would be even better, but 10s is also nice.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Also 0.01
Signed-off-by: Miek Gieben <miek@miek.nl>
											
										 
											2020-10-30 10:27:04 +01:00
										 |  |  | 			qname:         "example.org.",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 			metric:        "coredns_dns_requests_total",
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 			expectedValue: "1",
 | 
					
						
							|  |  |  | 		},
 | 
					
						
							|  |  |  | 		{
 | 
					
						
							|  |  |  | 			next:          test.NextHandler(dns.RcodeSuccess, nil),
 | 
					
						
							| 
									
										
											  
											
												Speed up testing (#4239)
* Speed up testing
* make notification run in the background, this recudes the test_readme
time from 18s to 0.10s
* reduce time for zone reload
* TestServeDNSConcurrent remove entirely. This took a whopping 58s for
  ... ? A few minutes staring didn't reveal wth it is actually testing.
  Making values smaller revealed race conditions in the tests. Remove
  entirely.
* Move many interval values to variables so we can reset them to short
  values for the tests.
* test_large_axfr: make the zone smaller. The number used 64K has no
  rational, make it 64/10 to speed up.
* TestProxyThreeWay: use client with shorter timeout
A few random tidbits in other tests.
Total time saved: 177s (almost 3m) - which makes it worthwhile again to
run the test locally:
this branch:
~~~
ok  	github.com/coredns/coredns/test	10.437s
cd plugin; time go t ./...
5,51s user 7,51s system 11,15s elapsed 744%CPU (
~~~
master:
~~~
ok  	github.com/coredns/coredns/test	35.252s
cd plugin; time go t ./...
157,64s user 15,39s system 50,05s elapsed 345%CPU ()
~~~
tests/ -25s
plugins/ -40s
This brings the total on 20s, and another 10s can be saved by fixing
dnstapio. Moving this to 5s would be even better, but 10s is also nice.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Also 0.01
Signed-off-by: Miek Gieben <miek@miek.nl>
											
										 
											2020-10-30 10:27:04 +01:00
										 |  |  | 			qname:         "example.org.",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 			metric:        "coredns_dns_requests_total",
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 			expectedValue: "2",
 | 
					
						
							|  |  |  | 		},
 | 
					
						
							|  |  |  | 		{
 | 
					
						
							|  |  |  | 			next:          test.NextHandler(dns.RcodeSuccess, nil),
 | 
					
						
							| 
									
										
											  
											
												Speed up testing (#4239)
* Speed up testing
* make notification run in the background, this recudes the test_readme
time from 18s to 0.10s
* reduce time for zone reload
* TestServeDNSConcurrent remove entirely. This took a whopping 58s for
  ... ? A few minutes staring didn't reveal wth it is actually testing.
  Making values smaller revealed race conditions in the tests. Remove
  entirely.
* Move many interval values to variables so we can reset them to short
  values for the tests.
* test_large_axfr: make the zone smaller. The number used 64K has no
  rational, make it 64/10 to speed up.
* TestProxyThreeWay: use client with shorter timeout
A few random tidbits in other tests.
Total time saved: 177s (almost 3m) - which makes it worthwhile again to
run the test locally:
this branch:
~~~
ok  	github.com/coredns/coredns/test	10.437s
cd plugin; time go t ./...
5,51s user 7,51s system 11,15s elapsed 744%CPU (
~~~
master:
~~~
ok  	github.com/coredns/coredns/test	35.252s
cd plugin; time go t ./...
157,64s user 15,39s system 50,05s elapsed 345%CPU ()
~~~
tests/ -25s
plugins/ -40s
This brings the total on 20s, and another 10s can be saved by fixing
dnstapio. Moving this to 5s would be even better, but 10s is also nice.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Also 0.01
Signed-off-by: Miek Gieben <miek@miek.nl>
											
										 
											2020-10-30 10:27:04 +01:00
										 |  |  | 			qname:         "example.org.",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 			metric:        "coredns_dns_requests_total",
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 			expectedValue: "3",
 | 
					
						
							|  |  |  | 		},
 | 
					
						
							|  |  |  | 		{
 | 
					
						
							|  |  |  | 			next:          test.NextHandler(dns.RcodeSuccess, nil),
 | 
					
						
							| 
									
										
											  
											
												Speed up testing (#4239)
* Speed up testing
* make notification run in the background, this recudes the test_readme
time from 18s to 0.10s
* reduce time for zone reload
* TestServeDNSConcurrent remove entirely. This took a whopping 58s for
  ... ? A few minutes staring didn't reveal wth it is actually testing.
  Making values smaller revealed race conditions in the tests. Remove
  entirely.
* Move many interval values to variables so we can reset them to short
  values for the tests.
* test_large_axfr: make the zone smaller. The number used 64K has no
  rational, make it 64/10 to speed up.
* TestProxyThreeWay: use client with shorter timeout
A few random tidbits in other tests.
Total time saved: 177s (almost 3m) - which makes it worthwhile again to
run the test locally:
this branch:
~~~
ok  	github.com/coredns/coredns/test	10.437s
cd plugin; time go t ./...
5,51s user 7,51s system 11,15s elapsed 744%CPU (
~~~
master:
~~~
ok  	github.com/coredns/coredns/test	35.252s
cd plugin; time go t ./...
157,64s user 15,39s system 50,05s elapsed 345%CPU ()
~~~
tests/ -25s
plugins/ -40s
This brings the total on 20s, and another 10s can be saved by fixing
dnstapio. Moving this to 5s would be even better, but 10s is also nice.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Also 0.01
Signed-off-by: Miek Gieben <miek@miek.nl>
											
										 
											2020-10-30 10:27:04 +01:00
										 |  |  | 			qname:         "example.org.",
 | 
					
						
							| 
									
										
										
										
											2020-03-26 09:17:33 +01:00
										 |  |  | 			metric:        "coredns_dns_responses_total",
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 			expectedValue: "4",
 | 
					
						
							|  |  |  | 		},
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ctx := context.TODO()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for i, tc := range tests {
 | 
					
						
							|  |  |  | 		req := new(dns.Msg)
 | 
					
						
							|  |  |  | 		if tc.qtype == 0 {
 | 
					
						
							|  |  |  | 			tc.qtype = dns.TypeA
 | 
					
						
							|  |  |  | 		}
 | 
					
						
							| 
									
										
											  
											
												Speed up testing (#4239)
* Speed up testing
* make notification run in the background, this recudes the test_readme
time from 18s to 0.10s
* reduce time for zone reload
* TestServeDNSConcurrent remove entirely. This took a whopping 58s for
  ... ? A few minutes staring didn't reveal wth it is actually testing.
  Making values smaller revealed race conditions in the tests. Remove
  entirely.
* Move many interval values to variables so we can reset them to short
  values for the tests.
* test_large_axfr: make the zone smaller. The number used 64K has no
  rational, make it 64/10 to speed up.
* TestProxyThreeWay: use client with shorter timeout
A few random tidbits in other tests.
Total time saved: 177s (almost 3m) - which makes it worthwhile again to
run the test locally:
this branch:
~~~
ok  	github.com/coredns/coredns/test	10.437s
cd plugin; time go t ./...
5,51s user 7,51s system 11,15s elapsed 744%CPU (
~~~
master:
~~~
ok  	github.com/coredns/coredns/test	35.252s
cd plugin; time go t ./...
157,64s user 15,39s system 50,05s elapsed 345%CPU ()
~~~
tests/ -25s
plugins/ -40s
This brings the total on 20s, and another 10s can be saved by fixing
dnstapio. Moving this to 5s would be even better, but 10s is also nice.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Also 0.01
Signed-off-by: Miek Gieben <miek@miek.nl>
											
										 
											2020-10-30 10:27:04 +01:00
										 |  |  | 		req.SetQuestion(tc.qname, tc.qtype)
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 		met.Next = tc.next
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-21 15:15:47 +01:00
										 |  |  | 		rec := dnstest.NewRecorder(&test.ResponseWriter{})
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 		_, err := met.ServeDNS(ctx, rec, req)
 | 
					
						
							|  |  |  | 		if err != nil {
 | 
					
						
							|  |  |  | 			t.Fatalf("Test %d: Expected no error, but got %s", i, err)
 | 
					
						
							|  |  |  | 		}
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-19 11:23:13 +00:00
										 |  |  | 		result := test.Scrape("http://" + ListenAddr + "/metrics")
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		if tc.expectedValue != "" {
 | 
					
						
							| 
									
										
										
										
											2019-01-19 11:23:13 +00:00
										 |  |  | 			got, _ := test.MetricValue(tc.metric, result)
 | 
					
						
							| 
									
										
										
										
											2016-10-26 10:01:52 +01:00
										 |  |  | 			if got != tc.expectedValue {
 | 
					
						
							|  |  |  | 				t.Errorf("Test %d: Expected value %s for metrics %s, but got %s", i, tc.expectedValue, tc.metric, got)
 | 
					
						
							|  |  |  | 			}
 | 
					
						
							|  |  |  | 		}
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | }
 | 
					
						
							| 
									
										
										
										
											2025-08-29 06:03:55 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | func TestMetricsHTTPTimeout(t *testing.T) {
 | 
					
						
							|  |  |  | 	met := New("localhost:0")
 | 
					
						
							|  |  |  | 	if err := met.OnStartup(); err != nil {
 | 
					
						
							|  |  |  | 		t.Fatalf("Failed to start metrics handler: %s", err)
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 	defer met.OnFinalShutdown()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Use context with timeout to prevent test from hanging indefinitely
 | 
					
						
							|  |  |  | 	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
 | 
					
						
							|  |  |  | 	defer cancel()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	done := make(chan error, 1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	go func() {
 | 
					
						
							|  |  |  | 		conn, err := net.Dial("tcp", ListenAddr)
 | 
					
						
							|  |  |  | 		if err != nil {
 | 
					
						
							|  |  |  | 			done <- err
 | 
					
						
							|  |  |  | 			return
 | 
					
						
							|  |  |  | 		}
 | 
					
						
							|  |  |  | 		defer conn.Close()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Send partial HTTP request and then stop sending data
 | 
					
						
							|  |  |  | 		// This will cause the server to wait for more data and hit ReadTimeout
 | 
					
						
							|  |  |  | 		partialRequest := "GET /metrics HTTP/1.1\r\nHost: " + ListenAddr + "\r\nContent-Length: 100\r\n\r\n"
 | 
					
						
							|  |  |  | 		_, err = conn.Write([]byte(partialRequest))
 | 
					
						
							|  |  |  | 		if err != nil {
 | 
					
						
							|  |  |  | 			done <- err
 | 
					
						
							|  |  |  | 			return
 | 
					
						
							|  |  |  | 		}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Now just wait - server should timeout trying to read the remaining data
 | 
					
						
							|  |  |  | 		// If server has no ReadTimeout, this will hang indefinitely
 | 
					
						
							|  |  |  | 		buffer := make([]byte, 1024)
 | 
					
						
							|  |  |  | 		_, err = conn.Read(buffer)
 | 
					
						
							|  |  |  | 		done <- err
 | 
					
						
							|  |  |  | 	}()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	select {
 | 
					
						
							|  |  |  | 	case <-done:
 | 
					
						
							|  |  |  | 		t.Log("HTTP request timed out by server")
 | 
					
						
							|  |  |  | 	case <-ctx.Done():
 | 
					
						
							|  |  |  | 		t.Error("HTTP request did not time out")
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | }
 | 
					
						
							| 
									
										
										
										
											2025-09-14 01:15:25 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | func TestMustRegister_DuplicateOK(t *testing.T) {
 | 
					
						
							|  |  |  | 	met := New("localhost:0")
 | 
					
						
							|  |  |  | 	met.Reg = prometheus.NewRegistry()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	g := promauto.NewGaugeVec(prometheus.GaugeOpts{Namespace: "test", Name: "dup"}, []string{"l"})
 | 
					
						
							|  |  |  | 	met.MustRegister(g)
 | 
					
						
							|  |  |  | 	// registering the same collector again should yield AlreadyRegisteredError internally and be ignored
 | 
					
						
							|  |  |  | 	met.MustRegister(g)
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func TestRemoveZone(t *testing.T) {
 | 
					
						
							|  |  |  | 	met := New("localhost:0")
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	met.AddZone("example.org.")
 | 
					
						
							|  |  |  | 	met.AddZone("example.net.")
 | 
					
						
							|  |  |  | 	met.RemoveZone("example.net.")
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	zones := met.ZoneNames()
 | 
					
						
							|  |  |  | 	for _, z := range zones {
 | 
					
						
							|  |  |  | 		if z == "example.net." {
 | 
					
						
							|  |  |  | 			t.Fatalf("zone %q still present after RemoveZone", z)
 | 
					
						
							|  |  |  | 		}
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func TestOnRestartStopsServer(t *testing.T) {
 | 
					
						
							|  |  |  | 	met := New("localhost:0")
 | 
					
						
							|  |  |  | 	if err := met.OnStartup(); err != nil {
 | 
					
						
							|  |  |  | 		t.Fatalf("startup failed: %v", err)
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// server should respond before restart
 | 
					
						
							|  |  |  | 	resp, err := http.Get("http://" + ListenAddr + "/metrics")
 | 
					
						
							|  |  |  | 	if err != nil {
 | 
					
						
							|  |  |  | 		t.Fatalf("pre-restart GET failed: %v", err)
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 	if resp != nil {
 | 
					
						
							|  |  |  | 		io.Copy(io.Discard, resp.Body)
 | 
					
						
							|  |  |  | 		resp.Body.Close()
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if err := met.OnRestart(); err != nil {
 | 
					
						
							|  |  |  | 		t.Fatalf("restart failed: %v", err)
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// after restart, the listener should be closed and request should fail
 | 
					
						
							|  |  |  | 	if _, err := http.Get("http://" + ListenAddr + "/metrics"); err == nil {
 | 
					
						
							|  |  |  | 		t.Fatalf("expected GET to fail after restart, but it succeeded")
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func TestRegistryGetOrSet(t *testing.T) {
 | 
					
						
							|  |  |  | 	r := newReg()
 | 
					
						
							|  |  |  | 	addr := "localhost:12345"
 | 
					
						
							|  |  |  | 	pr1 := prometheus.NewRegistry()
 | 
					
						
							|  |  |  | 	got1 := r.getOrSet(addr, pr1)
 | 
					
						
							|  |  |  | 	if got1 != pr1 {
 | 
					
						
							|  |  |  | 		t.Fatalf("first getOrSet should return provided registry")
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	pr2 := prometheus.NewRegistry()
 | 
					
						
							|  |  |  | 	got2 := r.getOrSet(addr, pr2)
 | 
					
						
							|  |  |  | 	if got2 != pr1 {
 | 
					
						
							|  |  |  | 		t.Fatalf("second getOrSet should return original registry, got different one")
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func TestOnRestartNoop(t *testing.T) {
 | 
					
						
							|  |  |  | 	met := New("localhost:0")
 | 
					
						
							|  |  |  | 	// without OnStartup, OnRestart should be a no-op
 | 
					
						
							|  |  |  | 	if err := met.OnRestart(); err != nil {
 | 
					
						
							|  |  |  | 		t.Fatalf("OnRestart returned error on no-op: %v", err)
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func TestContextHelpersEmpty(t *testing.T) {
 | 
					
						
							|  |  |  | 	if got := WithServer(context.TODO()); got != "" {
 | 
					
						
							|  |  |  | 		t.Fatalf("WithServer(nil) = %q, want empty", got)
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 	if got := WithView(context.TODO()); got != "" {
 | 
					
						
							|  |  |  | 		t.Fatalf("WithView(nil) = %q, want empty", got)
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | }
 |