// TestMakeServer makes a new TestServer for use in tests, but does not start
// the server.  If an error occurs during creation, a testing.Fatal is issued.
TestMakeServer makes a new TestServer for use in tests, but does not start
the server.  If an error occurs during creation, a testing.Fatal is issued.
// TestMakeServer makes a new TestServer for use in tests but does not start // the server . If an error occurs during creation a testing . Fatal is issued .
func TestMakeServer(tb testing.TB, wakers int, options ...Option) *TestServer {
	tb.Helper()
	glog.Info("resetting counters")
	expvar.Get("lines_total").(*expvar.Int).Set(0)
	expvar.Get("log_count").(*expvar.Int).Set(0)
	expvar.Get("log_lines_total").(*expvar.Map).Init()
	expvar.Get("log_opens_total").(*expvar.Map).Init()
	expvar.Get("log_closes_total").(*expvar.Map).Init()
	expvar.Get("file_truncates_total").(*expvar.Map).Init()
	expvar.Get("prog_loads_total").(*expvar.Map).Init()
	ctx, cancel := context.WithCancel(context.Background())
	waker, awaken := waker.NewTest(ctx, wakers)
	options = append(options,
		LogstreamPollWaker(waker),
	)
	m, err := New(ctx, metrics.NewStore(), options...)
	testutil.FatalIfErr(tb, err)
	return &TestServer{Server: m, waker: waker, awaken: awaken, tb: tb, cancel: cancel}
}
func TestMakeServer ( tb testing . TB , wakers int , options ... Option ) * TestServer { tb . Helper ( ) glog . Info ( " " ) expvar . Get ( " " ) . ( * expvar . Int ) . Set ( 0 ) expvar . Get ( " " ) . ( * expvar . Int ) . Set ( 0 ) expvar . Get ( " " ) . ( * expvar . Map ) . Init ( ) expvar . Get ( " " ) . ( * expvar . Map ) . Init ( ) expvar . Get ( " " ) . ( * expvar . Map ) . Init ( ) expvar . Get ( " " ) . ( * expvar . Map ) . Init ( ) expvar . Get ( " " ) . ( * expvar . Map ) . Init ( ) ctx , cancel := context . WithCancel ( context . Background ( ) ) waker , awaken := waker . NewTest ( ctx , wakers ) options = append ( options , LogstreamPollWaker ( waker ) , ) m , err := New ( ctx , metrics . NewStore ( ) , options ... ) testutil . FatalIfErr ( tb , err ) return & TestServer { Server : m , waker : waker , awaken : awaken , tb : tb , cancel : cancel } }
TestMakeServer makes a new TestServer for use in tests, but does not start
the server.
TestMakeServer makes a new TestServer for use in tests but does not start the server .
// Reset counters when running multiple tests.  Tests that use expvar // helpers cannot be made parallel.