Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Dec 21, 2018
1 parent 706e13b commit 85be51a
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions openldap/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import grp
import os
import pwd
from copy import deepcopy

import pytest
Expand All @@ -14,20 +16,40 @@

@pytest.fixture(scope='session')
def dd_environment():
with TempDir() as d:
host_socket_path = os.path.join(d, 'ldapi')
try:
with TempDir() as d:
host_socket_path = os.path.join(d, 'ldapi')

if not file_exists(host_socket_path):
if not file_exists(host_socket_path):
os.chmod(d, 0o770)
create_file(host_socket_path)
os.chmod(host_socket_path, 0o640)
stat_info = os.stat(d)
mode = stat_info.st_mode
uid = stat_info.st_uid
gid = stat_info.st_gid

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

#os.chown(d, 2000, 2000)
os.chmod(d, 0o777)
create_file(host_socket_path)
os.chmod(host_socket_path, 0o777)

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
except:
new_stat_info = os.stat(d)
raise Exception(
'mode: {} -> {}\n'
'uid: {} -> {}\n'
'gid: {} -> {}'
.format(
mode, new_stat_info.st_mode,
uid, new_stat_info.st_uid,
gid, new_stat_info.st_gid,
)
)


@pytest.fixture
Expand Down

0 comments on commit 85be51a

Please sign in to comment.