Skip to content

Commit 00808c5

Browse files
committed
Manually merge PR135 to address a 'make test' regression and make sure unit tests stay isolated in designated test folders. Will likely be extended/replaced/obsoleted by PR134 with the general containerization of unit tests.
git-svn-id: svn+ssh://svn.code.sf.net/p/migrid/code/trunk@6151 b75ad72c-e7d7-11dd-a971-7dbc132099af
1 parent 8fcc3c3 commit 00808c5

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ dependencies: ./envhelp/venv/pyvenv.cfg ./envhelp/py3.depends
5151
testconfig: ./envhelp/output/testconfs
5252

5353
./envhelp/output/testconfs:
54-
@echo "generating test configuration"
5554
@./envhelp/makeconfig test --python2
5655
@./envhelp/makeconfig test
5756
@mkdir -p ./envhelp/output/certs

envhelp/makeconfig.py

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@
3636
sys.path.append(os.path.realpath(
3737
os.path.join(os.path.dirname(__file__), "..")))
3838

39-
from mig.shared.install import generate_confs
39+
from mig.shared.install import MIG_BASE, generate_confs
4040

41-
_ENVHELP_OUTPUT_DIR = os.path.realpath(
41+
_LOCAL_ENVHELP_OUTPUT_DIR = os.path.realpath(
4242
os.path.join(os.path.dirname(__file__), "output"))
4343
_MAKECONFIG_ALLOWED = ["local", "test"]
44-
_PYTHON_MAJOR = os.environ.get('PY', '3')
4544

4645

4746
def _at(sequence, index=-1, default=None):
@@ -54,17 +53,34 @@ def _at(sequence, index=-1, default=None):
5453

5554
def write_testconfig(env_name, is_py2=False):
5655
confs_name = 'confs' if env_name == 'local' else '%sconfs' % (env_name,)
56+
confs_suffix = 'py2' if is_py2 else 'py3'
57+
5758
overrides = {
58-
'destination': os.path.join(_ENVHELP_OUTPUT_DIR, confs_name),
59-
'destination_suffix': "-py%s" % ('2' if is_py2 else '3',),
59+
'destination': os.path.join(_LOCAL_ENVHELP_OUTPUT_DIR, confs_name),
60+
'destination_suffix': "-%s" % (confs_suffix,),
6061
}
62+
63+
# determine the paths by which we will access the various configured dirs
6164
if is_py2:
62-
overrides.update(**{
63-
'mig_code': '/usr/src/app/mig',
64-
'mig_certs': '/usr/src/app/envhelp/output/certs',
65-
'mig_state': '/usr/src/app/envhelp/output/state',
66-
})
67-
generate_confs(_ENVHELP_OUTPUT_DIR, **overrides)
65+
env_mig_base = '/usr/src/app'
66+
else:
67+
env_mig_base = MIG_BASE
68+
conf_dir_path = os.path.join(env_mig_base, "envhelp/output")
69+
70+
overrides.update(**{
71+
'mig_code': os.path.join(conf_dir_path, 'mig'),
72+
'mig_certs': os.path.join(conf_dir_path, 'certs'),
73+
'mig_state': os.path.join(conf_dir_path, 'state'),
74+
})
75+
76+
print('generating "%s" configuration ...' % (confs_name,))
77+
78+
generate_confs(_LOCAL_ENVHELP_OUTPUT_DIR, **overrides)
79+
80+
confs_destination = ''.join(
81+
[overrides['destination'], overrides['destination_suffix']])
82+
print('wrote configuration for "%s" env into: %s' %
83+
(confs_suffix, confs_destination))
6884

6985

7086
def main_(argv):
@@ -84,8 +100,8 @@ def main_(argv):
84100
def main(argv=sys.argv):
85101
try:
86102
main_(argv)
87-
except RuntimeError as e:
88-
print('makeconfig: %s' % (str(e),))
103+
except RuntimeError as rte:
104+
print('makeconfig: %s' % rte)
89105
exit(1)
90106

91107

0 commit comments

Comments
 (0)