func (cs Cluster) Init(ctx context.Context, out, errOut io.Writer) {
	e2e.Run(ctx, out, errOut, "./cockroach",
		"init",
		"--insecure",
		"--host="+cs[0].Addr,
	)
}
Init runs the cockroach init command against the cluster
package cockroach
import (
	"context"
	"fmt"
	"io"
	"net"
	"strconv"
	"strings"
	"time"
	"github.com/jackc/pgx/v4"
	"github.com/authzed/spicedb/e2e"
)
type Node struct {
	Peers    []string
	Addr     string
	Httpaddr string
	ID       string
	pid  int
	conn *pgx.Conn
}
func (c *Node) Start(ctx context.Context) error {
	logfile, err := e2e.File(ctx, fmt.Sprintf("crdb-%s.log", c.ID))
	if err != nil {
		return err
	}
	cmd := []string{
		"./cockroach",
		"start",
		"--store=node" + c.ID,
		"--logtostderr",
		"--insecure",
		"--listen-addr=" + c.Addr,
		"--http-addr=" + c.Httpaddr,
		"--join=" + strings.Join(c.Peers, ","),
	}
	c.pid, err = e2e.GoRun(ctx, logfile, logfile, cmd...)
	return err
}
func (c *Node) ConnectionString(dbName string) string {
	return fmt.Sprintf("postgresql://root@%s/%s?sslmode=disable", c.Addr, dbName)
}
func (c *Node) Connect(ctx context.Context, out io.Writer, dbName string) error {
	if c.pid < 1 {
		return fmt.Errorf("can't connect to unstarted cockroach")
	}
	conn, err := pgx.Connect(ctx, c.ConnectionString(dbName))
	if err != nil {
		return err
	}
	c.conn = conn
	return nil
}
func (c *Node) Conn() *pgx.Conn {
	return c.conn
}
type Cluster []*Node
func NewCluster(n int) Cluster {
	cs := make([]*Node, 0, n)
	peers := make([]string, 0, n)
	port := 26257
	http := 8080
	for i := 0; i < n; i++ {
		addr := net.JoinHostPort("localhost", strconv.Itoa(port+i))
		peers = append(peers, addr)
		cs = append(cs, &Node{
			ID:       strconv.Itoa(i + 1),
			Addr:     addr,
			Httpaddr: net.JoinHostPort("localhost", strconv.Itoa(http+i)),
		})
	}
	for i := range cs {
		cs[i].Peers = peers
	}
	return cs
}
func (cs Cluster) Started() bool {
	for _, c := range cs {
		if c.pid <= 0 {
			return false
		}
	}
	return true
}