def dd_environment(e2e_instance): with TempDir('vault-jwt') as jwt_dir, TempDir('vault-sink') as sink_dir: token_file = os.path.join(sink_dir, 'token') if not os.path.exists(token_file): os.chmod(sink_dir, 0o777) create_file(token_file) os.chmod(token_file, 0o777) with docker_run( COMPOSE_FILE, env_vars={ 'JWT_DIR': jwt_dir, 'SINK_DIR': sink_dir, 'SERVER_CONFIG_FILE': get_vault_server_config_file() }, conditions=[ WaitAndUnsealVault(HEALTH_ENDPOINT), ApplyPermissions(token_file) ], sleep=10, mount_logs=True, ): set_client_token_path(token_file) yield e2e_instance, { 'docker_volumes': ['{}:/home/vault-sink'.format(sink_dir)] }
def add_messages(cls, queue_root, queues, in_count): for _ in range(10000): shuffle(queues) rand_queue = sample(queues, 1)[0] queue_file = ensure_unicode(binascii.b2a_hex(os.urandom(7))) create_file(os.path.join(queue_root, rand_queue, queue_file)) # keep track of what we put in in_count[rand_queue][0] += 1
def test_exclude_dirs(aggregator): with temp_directory() as td: exclude = ['node_modules', 'vendor'] instance = {'directory': td, 'recursive': True, 'countonly': True, 'exclude_dirs': exclude} for ed in exclude: create_file(os.path.join(td, ed, 'file')) dir_check = DirectoryCheck('directory', {}, [instance]) dir_check.check(instance) assert len(aggregator.metric_names) == 1
def dd_environment(): with TempDir() as d: host_socket_path = os.path.join(d, 'ldapi') if not path_exists(host_socket_path): os.chmod(d, 0o777) create_file(host_socket_path) os.chmod(host_socket_path, 0o640) with docker_run( compose_file=os.path.join(HERE, 'compose', 'docker-compose.yaml'), env_vars={'HOST_SOCKET_DIR': d}, log_patterns='slapd starting', ): yield DEFAULT_INSTANCE