# Path: riak/util.py
# def deep_merge(a, b):
#     """Merge two deep dicts non-destructively
# 
#     Uses a stack to avoid maximum recursion depth exceptions
# 
#     >>> a = {'a': 1, 'b': {1: 1, 2: 2}, 'd': 6}
#     >>> b = {'c': 3, 'b': {2: 7}, 'd': {'z': [1, 2, 3]}}
#     >>> c = deep_merge(a, b)
#     >>> from pprint import pprint; pprint(c)
#     {'a': 1, 'b': {1: 1, 2: 7}, 'c': 3, 'd': {'z': [1, 2, 3]}}
#     """
#     assert quacks_like_dict(a), quacks_like_dict(b)
#     dst = a.copy()
# 
#     stack = [(dst, b)]
#     while stack:
#         current_dst, current_src = stack.pop()
#         for key in current_src:
#             if key not in current_dst:
#                 current_dst[key] = current_src[key]
#             else:
#                 if (quacks_like_dict(current_src[key]) and
#                         quacks_like_dict(current_dst[key])):
#                     stack.append((current_dst[key], current_src[key]))
#                 else:
#                     current_dst[key] = current_src[key]
#     return dst


import os.path
import threading
import string
import re
import random
import shutil
import socket
import time
import stat
from subprocess import Popen, PIPE
from riak.util import deep_merge
from six import string_types
            "map_cache_size": 0,
            "vnode_cache_entries": 0,
            "test": True,
            "memory_backend": {
                "test": True,
            },
        },
        "riak_search": {
            "enabled": True,
            "search_backend": Atom("riak_search_test_backend")
        },
    }

    DEFAULT_BASE_DIR = "RUNNER_BASE_DIR=${RUNNER_SCRIPT_DIR%/*}"

    _temp_bin = None
    _temp_etc = None
    _temp_log = None
    _temp_pipe = None

    def __init__(self, tmp_dir="/tmp/riak/test_server",
                 bin_dir=os.path.expanduser("~/.riak/install/riak-0.14.2/bin"),
                 vm_args=None, **options):
        self._lock = threading.Lock()
        self.temp_dir = tmp_dir
        self.bin_dir = bin_dir
        self._prepared = False
        self._started = False
        self.vm_args = self.VM_ARGS_DEFAULTS.copy()
        if vm_args is not None:

# Path: riak/util.py
# def deep_merge(a, b):
#     """Merge two deep dicts non-destructively
# 
#     Uses a stack to avoid maximum recursion depth exceptions
# 
#     >>> a = {'a': 1, 'b': {1: 1, 2: 2}, 'd': 6}
#     >>> b = {'c': 3, 'b': {2: 7}, 'd': {'z': [1, 2, 3]}}
#     >>> c = deep_merge(a, b)
#     >>> from pprint import pprint; pprint(c)
#     {'a': 1, 'b': {1: 1, 2: 7}, 'c': 3, 'd': {'z': [1, 2, 3]}}
#     """
#     assert quacks_like_dict(a), quacks_like_dict(b)
#     dst = a.copy()
# 
#     stack = [(dst, b)]
#     while stack:
#         current_dst, current_src = stack.pop()
#         for key in current_src:
#             if key not in current_dst:
#                 current_dst[key] = current_src[key]
#             else:
#                 if (quacks_like_dict(current_src[key]) and
#                         quacks_like_dict(current_dst[key])):
#                     stack.append((current_dst[key], current_src[key]))
#                 else:
#                     current_dst[key] = current_src[key]
#     return dst


# Path: riak/test_server.py
import os.path
import threading
import string
import re
import random
import shutil
import socket
import time
import stat
from subprocess import Popen, PIPE
from riak.util import deep_merge
from six import string_types

            "map_cache_size": 0,
            "vnode_cache_entries": 0,
            "test": True,
            "memory_backend": {
                "test": True,
            },
        },
        "riak_search": {
            "enabled": True,
            "search_backend": Atom("riak_search_test_backend")
        },
    }

    DEFAULT_BASE_DIR = "RUNNER_BASE_DIR=${RUNNER_SCRIPT_DIR%/*}"

    _temp_bin = None
    _temp_etc = None
    _temp_log = None
    _temp_pipe = None

    def __init__(self, tmp_dir="/tmp/riak/test_server",
                 bin_dir=os.path.expanduser("~/.riak/install/riak-0.14.2/bin"),
                 vm_args=None, **options):
        self._lock = threading.Lock()
        self.temp_dir = tmp_dir
        self.bin_dir = bin_dir
        self._prepared = False
        self._started = False
        self.vm_args = self.VM_ARGS_DEFAULTS.copy()
        if vm_args is not None:

            self.vm_args = deep_merge(self.vm_args, vm_args)