mirror of
				https://github.com/tailscale/tailscale.git
				synced 2025-10-31 16:22:03 +01:00 
			
		
		
		
	The c2n handling code was using the Go httptest package's ResponseRecorder code but that's in a test package which brings in Go's test certs, etc. This forks the httptest recorder type into its own package that only has the recorder and adds a test that we don't re-introduce a dependency on httptest. Updates #12614 Change-Id: I3546f49972981e21813ece9064cc2be0b74f4b16 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright (c) Tailscale Inc & AUTHORS
 | |
| // SPDX-License-Identifier: BSD-3-Clause
 | |
| 
 | |
| package main // import "tailscale.com/cmd/tailscaled"
 | |
| 
 | |
| import (
 | |
| 	"testing"
 | |
| 
 | |
| 	"tailscale.com/tstest/deptest"
 | |
| )
 | |
| 
 | |
| func TestNothing(t *testing.T) {
 | |
| 	// This test does nothing on purpose, so we can run
 | |
| 	// GODEBUG=memprofilerate=1 go test -v -run=Nothing -memprofile=prof.mem
 | |
| 	// without any errors about no matching tests.
 | |
| }
 | |
| 
 | |
| func TestDeps(t *testing.T) {
 | |
| 	deptest.DepChecker{
 | |
| 		GOOS:   "darwin",
 | |
| 		GOARCH: "arm64",
 | |
| 		BadDeps: map[string]string{
 | |
| 			"testing":                        "do not use testing package in production code",
 | |
| 			"gvisor.dev/gvisor/pkg/hostarch": "will crash on non-4K page sizes; see https://github.com/tailscale/tailscale/issues/8658",
 | |
| 			"net/http/httptest":              "do not use httptest in production code",
 | |
| 			"net/http/internal/testcert":     "do not use httptest in production code",
 | |
| 		},
 | |
| 	}.Check(t)
 | |
| 
 | |
| 	deptest.DepChecker{
 | |
| 		GOOS:   "linux",
 | |
| 		GOARCH: "arm64",
 | |
| 		BadDeps: map[string]string{
 | |
| 			"testing":                                        "do not use testing package in production code",
 | |
| 			"gvisor.dev/gvisor/pkg/hostarch":                 "will crash on non-4K page sizes; see https://github.com/tailscale/tailscale/issues/8658",
 | |
| 			"google.golang.org/protobuf/proto":               "unexpected",
 | |
| 			"github.com/prometheus/client_golang/prometheus": "use tailscale.com/metrics in tailscaled",
 | |
| 		},
 | |
| 	}.Check(t)
 | |
| }
 |