Skip to content

Commit

Permalink
docker...
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Dec 21, 2018
1 parent 85be51a commit 1d2ed72
Showing 1 changed file with 14 additions and 36 deletions.
50 changes: 14 additions & 36 deletions openldap/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# (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 @@ -16,40 +14,20 @@

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

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)
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,
)
)
with TempDir() as d:
host_socket_path = os.path.join(d, 'ldapi')

if not file_exists(host_socket_path):
os.chmod(d, 0o770)
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


@pytest.fixture
Expand Down

0 comments on commit 1d2ed72

Please sign in to comment.