func verifyCleanup(key roachpb.Key, coord *TxnCoordSender, eng engine.Engine, t *testing.T) { util.SucceedsSoon(t, func() error { coord.Lock() l := len(coord.txns) coord.Unlock() if l != 0 { return fmt.Errorf("expected empty transactions map; got %d", l) } meta := &enginepb.MVCCMetadata{} ok, _, _, err := eng.GetProto(engine.MakeMVCCMetadataKey(key), meta) if err != nil { return fmt.Errorf("error getting MVCC metadata: %s", err) } if ok && meta.Txn != nil { return fmt.Errorf("found unexpected write intent: %s", meta) } return nil }) }