Skip to content
Snippets Groups Projects
Commit 8a072922 authored by ale's avatar ale
Browse files

Suppress some linter warnings in tests

parent 305126af
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@ func TestProxyHeaders(t *testing.T) {
if err != nil {
host = r.RemoteAddr
}
io.WriteString(w, host)
io.WriteString(w, host) // nolint: errcheck
})
p1, err := newProxyHeaders(h, []string{"1.2.3.4/16"})
......
......@@ -22,13 +22,13 @@ import (
func saveCertificate(cert *x509.Certificate, path string) {
data := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: cert.Raw})
ioutil.WriteFile(path, data, 0644)
ioutil.WriteFile(path, data, 0644) // nolint: errcheck
}
func savePrivateKey(pkey *ecdsa.PrivateKey, path string) {
der, _ := x509.MarshalECPrivateKey(pkey)
data := pem.EncodeToMemory(&pem.Block{Type: "EC PRIVATE KEY", Bytes: der})
ioutil.WriteFile(path, data, 0600)
ioutil.WriteFile(path, data, 0600) // nolint: errcheck
}
func generateTestCA(t testing.TB, dir string) (*x509.Certificate, *ecdsa.PrivateKey) {
......@@ -46,8 +46,8 @@ func generateTestCA(t testing.TB, dir string) (*x509.Certificate, *ecdsa.Private
SignatureAlgorithm: x509.ECDSAWithSHA256,
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
BasicConstraintsValid: true,
IsCA: true,
MaxPathLen: 1,
IsCA: true,
MaxPathLen: 1,
}
der, err := x509.CreateCertificate(rand.Reader, &template, &template, pkey.Public(), pkey)
if err != nil {
......@@ -148,10 +148,10 @@ func TestTLS_Serve(t *testing.T) {
},
}
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "OK")
io.WriteString(w, "OK") // nolint: errcheck
})
go Serve(h, config, ":19898")
go Serve(h, config, ":19898") // nolint: errcheck
time.Sleep(100 * time.Millisecond)
// A client without a certificate should get a transport-level error.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment