MCPcopy Index your code
hub / github.com/coder/envbox / writePEM

Function writePEM

integration/integrationtest/certs.go:59–71  ·  view source on GitHub ↗
(t testing.TB, path string, typ string, contents []byte)

Source from the content-addressed store, hash-verified

57}
58
59func writePEM(t testing.TB, path string, typ string, contents []byte) {
60 t.Helper()
61
62 f, err := os.Create(path)
63 require.NoError(t, err)
64 defer f.Close()
65
66 err = pem.Encode(f, &pem.Block{
67 Type: typ,
68 Bytes: contents,
69 })
70 require.NoError(t, err)
71}
72
73func WriteCertificate(t testing.TB, c tls.Certificate, certPath, keyPath string) {
74 require.Len(t, c.Certificate, 1, "expecting 1 certificate")

Callers 1

WriteCertificateFunction · 0.85

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected