func createTestClientForUser(t *testing.T, stopper *stop.Stopper, addr, user string) *client.DB { var ctx base.Context ctx.InitDefaults() ctx.User = user ctx.SSLCA = filepath.Join(security.EmbeddedCertsDir, security.EmbeddedCACert) ctx.SSLCert = filepath.Join(security.EmbeddedCertsDir, fmt.Sprintf("%s.crt", user)) ctx.SSLCertKey = filepath.Join(security.EmbeddedCertsDir, fmt.Sprintf("%s.key", user)) sender, err := client.NewSender(rpc.NewContext(&ctx, nil, stopper), addr) if err != nil { t.Fatal(err) } return client.NewDB(sender) }
func fillCertPaths(context *base.Context, user string) { context.SSLCA = filepath.Join(security.EmbeddedCertsDir, security.EmbeddedCACert) context.SSLCAKey = filepath.Join(security.EmbeddedCertsDir, security.EmbeddedCAKey) context.SSLCert = filepath.Join(security.EmbeddedCertsDir, fmt.Sprintf("%s.crt", user)) context.SSLCertKey = filepath.Join(security.EmbeddedCertsDir, fmt.Sprintf("%s.key", user)) }