-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
pending-discussionThe issue or pull request needs more discussion before it can be closed or mergedThe issue or pull request needs more discussion before it can be closed or merged
Milestone
Description
Description of Issue/Question
Hello.
Trying to develop #49140 for #14613 (and related #7883, #32578), I figured out that the test infrastructure does not define and use proper root trees.
- the configuration is transplanted to a
root_dirbytests.integration.TestDaemon.transplant_configs- every paths in the configuration files are prefixed with
/tmp/salt-tests-tmpdir/rootdir/
- every paths in the configuration files are prefixed with
- the
tests.support.mixins.AdaptedConfigurationTestCaseMixinload the configuration files generated at the previous step- it changes the
root_dirto a temporary directory/tmp/tmpXXXXXX/tmp/and apply the new configuration
- it changes the
The actual test suite does not choke on this because salt accepts to use paths outside root_dir since not all options are prefixed with root_dir.
But in combination with my work at #49140, it results in the paths to be defined as /tmp/tmpXXXXXX/tmp/salt-tests-tmpdir/rootdir/ which is completely wrong and lots of tests fails because of that, like:
10:58:04 -> unit.fileserver.test_roots.RootsTest.test_dir_list ......................
10:58:04 Traceback (most recent call last):
10:58:04 File "/tmp/kitchen/testing/tests/unit/fileserver/test_roots.py", line 158, in test_dir_list
10:58:04 self.assertIn('empty_dir', ret)
10:58:04 AssertionError: u'empty_dir' not found in []
I propose the following in preparation for salt to strictly respects the root_dir as everything must be under this root_dir:
- generate a pristine
root_dir- I proposed to define
tests.integration.TestDaemon.generate_new_configfor that purpose - create all the salt-needed directory tree and configuration files (like previously by
tests.integration.TestDaemon.transplant_configs) but they are never used directly - copy files from
tests/integration/filesto the proper place under the pristineroot_dir - replace the pristine
root_dirpath prefix from all the paths in the configuration files with/(or use any kind of placeholder to make sure it will raise if the replacement is not done properly)
- I proposed to define
- duplicate the configuration tree each time we need to load a new configuration
- when transplanting the configuration by
tests.integration.TestDaemon.transplant_configs - when defining a temporary configuration with
tests.support.mixins.AdaptedConfigurationTestCaseMixin - copy the pristine
root_dirtree to the newroot_dir - replace the placeholder prefix with the path to the new
root_dir(the proposal Feature/expand all paths #49140 will make this step obsolete by prefixing all the paths with this newroot_dir) - load the configuration with the new
root_dir
- when transplanting the configuration by
Setup
N/A
Steps to Reproduce Issue
Run the integration tests.
Versions Report
salt --versions-report
Salt Version:
Salt: 2018.3.3
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.6.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.10
libgit2: 0.26.0
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: 0.26.2
Python: 3.6.7 (default, Oct 22 2018, 11:32:17)
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.5
System Versions:
dist: Ubuntu 18.04 bionic
locale: UTF-8
machine: x86_64
release: 4.15.0-43-generic
system: Linux
version: Ubuntu 18.04 bionic
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
pending-discussionThe issue or pull request needs more discussion before it can be closed or mergedThe issue or pull request needs more discussion before it can be closed or merged