MCPcopy Create free account
hub / github.com/prometheus/common / TestTLSRoundTripper_Inline

Function TestTLSRoundTripper_Inline

config/http_config_test.go:1168–1279  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1166}
1167
1168func TestTLSRoundTripper_Inline(t *testing.T) {
1169 handler := func(w http.ResponseWriter, _ *http.Request) {
1170 fmt.Fprint(w, ExpectedMessage)
1171 }
1172 testServer, err := newTestServer(handler)
1173 require.NoError(t, err)
1174 defer testServer.Close()
1175
1176 testCases := []struct {
1177 caText, caFile string
1178 certText, certFile string
1179 keyText, keyFile string
1180
1181 errMsg string
1182 }{
1183 {
1184 // File-based everything.
1185 caFile: TLSCAChainPath,
1186 certFile: ClientCertificatePath,
1187 keyFile: ClientKeyNoPassPath,
1188 },
1189 {
1190 // Inline CA.
1191 caText: readFile(t, TLSCAChainPath),
1192 certFile: ClientCertificatePath,
1193 keyFile: ClientKeyNoPassPath,
1194 },
1195 {
1196 // Inline cert.
1197 caFile: TLSCAChainPath,
1198 certText: readFile(t, ClientCertificatePath),
1199 keyFile: ClientKeyNoPassPath,
1200 },
1201 {
1202 // Inline key.
1203 caFile: TLSCAChainPath,
1204 certFile: ClientCertificatePath,
1205 keyText: readFile(t, ClientKeyNoPassPath),
1206 },
1207 {
1208 // Inline everything.
1209 caText: readFile(t, TLSCAChainPath),
1210 certText: readFile(t, ClientCertificatePath),
1211 keyText: readFile(t, ClientKeyNoPassPath),
1212 },
1213
1214 {
1215 // Invalid inline CA.
1216 caText: "badca",
1217 certText: readFile(t, ClientCertificatePath),
1218 keyText: readFile(t, ClientKeyNoPassPath),
1219
1220 errMsg: "unable to use specified CA cert inline",
1221 },
1222 {
1223 // Invalid cert.
1224 caText: readFile(t, TLSCAChainPath),
1225 certText: "badcert",

Callers

nothing calls this directly

Calls 5

newTestServerFunction · 0.85
readFileFunction · 0.85
SecretTypeAlias · 0.85
NewClientFromConfigFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…