Commit 114b7fd6 authored by Kirill Smelkov's avatar Kirill Smelkov

X go/neo: Fix benchmarkGetObject

- without registering M to tracer it was failing as

  BenchmarkGetObjectNetPipe
      neo_test.go:491: main: expect: *neo.eventMStartReady:
          want: &{m true}
          have: &{ true}
          diff:  {
          - Where: "m",
          + Where: "",
            Ready: true,
           }

- Client is now required to be explicitly Run, but I forgot to update
  thi function in eae3b427.
parent 01ebcbe7
...@@ -194,6 +194,7 @@ func (c *Client) withOperational(ctx context.Context) error { ...@@ -194,6 +194,7 @@ func (c *Client) withOperational(ctx context.Context) error {
for { for {
c.node.StateMu.RLock() c.node.StateMu.RLock()
if c.operational { if c.operational {
//fmt.Printf("withOperation -> ready\n");
return nil return nil
} }
...@@ -206,9 +207,6 @@ func (c *Client) withOperational(ctx context.Context) error { ...@@ -206,9 +207,6 @@ func (c *Client) withOperational(ctx context.Context) error {
case <-ctx.Done(): case <-ctx.Done():
return ctx.Err() return ctx.Err()
// XXX case <-c.runctx.Done():
// return "op on closed client ..." ?
case <-ready: case <-ready:
// ok - try to relock and read again. // ok - try to relock and read again.
} }
......
...@@ -457,6 +457,8 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f ...@@ -457,6 +457,8 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f
tG := tracetest.NewEventChecker(b, nil /* XXX */, cG) tG := tracetest.NewEventChecker(b, nil /* XXX */, cG)
tracer := NewTraceCollector(tdispatch1{cG}) tracer := NewTraceCollector(tdispatch1{cG})
tracer.RegisterNode(M.node, "m")
tracing.Lock() tracing.Lock()
pnode := traceNodeChanged_Attach(nil, tracer.traceNode) pnode := traceNodeChanged_Attach(nil, tracer.traceNode)
traceMasterStartReady_Attach(tracer.pg, tracer.traceMasterStartReady) traceMasterStartReady_Attach(tracer.pg, tracer.traceMasterStartReady)
...@@ -481,12 +483,15 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f ...@@ -481,12 +483,15 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f
// now after we know Maddr create S & C and start S serving // now after we know Maddr create S & C and start S serving
S := tNewStorage("abc1", Maddr, "", Snet, zback) S := tNewStorage("abc1", Maddr, "", Snet, zback)
C := NewClient("abc1", Maddr, Cnet)
wg.Go(func(ctx context.Context) error { wg.Go(func(ctx context.Context) error {
return S.Run(ctx) return S.Run(ctx)
}) })
C := NewClient("abc1", Maddr, Cnet)
wg.Go(func(ctx context.Context) error {
return C.Run(ctx)
})
// command M to start // command M to start
tG.Expect(masterStartReady("m", true)) // <- XXX better with M api tG.Expect(masterStartReady("m", true)) // <- XXX better with M api
tracer.Detach() tracer.Detach()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment