Commit Graph

630 Commits

Author SHA1 Message Date
Thomas S Hatch
f68816ed47 Remove unused import 2012-08-30 13:25:17 -06:00
Pedro Algarvio
8b645b339b Fix #1879. Searching/matching is now done on multiple lines.
* `salt.modules.file.contains()`, `salt.modules.file.contains_regex()`, `salt.modules.file.contains_glob()` and `salt.utils.find` now do the searching/matching against chunks of data; using defaults, 32KB chunks of data in files; instead of searching/matching line by line.
* Based on the above changes `salt.states.file.append()`, when checking if the text to append is already present, now uses `salt.modules.file.contains_regex()` in order to match spanning multiple lines ignoring the addition/deletion of white-space or new lines, except inside commas.
* The regex used on the above item is built at runtime using `salt.utils.build_whitepace_splited_regex()`, just feed the text to it and you'll get back the proper regex to the matching/searching on, for example `salt.modules.file.contains_regex()`.
* Added tests for all this code.
2012-08-28 10:03:11 +01:00
Pedro Algarvio
9dfce0f7d2 Final fix for saltstack/salt#1756
Don't try to import `salt.log` during tests. Adapt `check_user` test accordingly.
2012-08-11 01:28:49 +01:00
Pedro Algarvio
1cae292c68 Fix tests/unit/utils/verify_test.py since verify_user no longer accepts the log argument. 2012-08-11 00:30:13 +01:00
Pedro Algarvio
639471d110 Multi-platform path joiner(appender)
This commit kind of reverts the previous "no more os.sep.join ..." commit by solving the issue which led to switching that code to `os.path.join`. Tested both on linux and windows.
2012-08-08 14:43:34 +01:00
Pedro Algarvio
759d67ffc0 Reverted back the --key-logfile deprecation.
On the parsers cleanup branch, I though about making the available options as equal as possible. Since the log_file setting for the master and the minion could be separately set,  I made the logfile option for the key also log_file. Yet, since there's no key specific config file, it shares master, one could only specify the log_file settings from the cli,   it could not be hardcoded on the config file, unless, we made a separate config file just for key.
So, in order to reduce required changes, and keep it all as backwards compatible as possible, the key log file options is now, once again, `--key-logfile` which will allow us to   hardcode it in the masters config file as `key_logfile`.
This will also, hopefully make travis behave better too.
2012-08-08 01:08:38 +01:00
Intchanter
3c05a3ee78 Merge branch 'develop' of https://github.com/saltstack/salt into develop
Conflicts:
	tests/integration/modules/grains.py
	tests/integration/states/host.py
	tests/unit/utils/find_test.py
2012-07-04 18:29:13 -06:00
Intchanter
49b2465cf0 Cleaned up syntax error 2012-07-04 17:42:53 -06:00
Dan Colish
aacd9cc5bd Use getpass.getuser since os.getlogin requires a tty and tests do not
always run with one.
2012-06-30 23:31:01 -07:00
Dan Colish
040c249866 Fix find_test on OSX 2012-06-30 15:23:50 -07:00
Jeff Hutchins
b380991316 Merge git://github.com/saltstack/salt into tests
Conflicts:
	tests/unit/utils/find_test.py
2012-06-30 15:58:17 -06:00
Dan Colish
1b1431ba66 Skip verify_env test on windows. 2012-06-30 14:11:37 -07:00
Jeff Hutchins
ff54029c98 Make tests on utils.find run with nose. 2012-06-30 14:48:40 -06:00
Dan Colish
01b74fc04c Add unittests for salt.utils.verify 2012-06-30 13:28:15 -07:00
Intchanter
a1433ef5ec PEP8 fixes for tests 2012-06-30 14:10:34 -06:00
Dan Colish
edfb3d2560 Merge branch 'develop' of git://github.com/saltstack/salt into develop
Conflicts:
	tests/unit/utils/find_test.py
2012-06-30 12:46:04 -07:00
Jeff Schroeder
07b4c8b4ed Skip the rvm and gem module/state tests when mock is missing
The mock python module is required for the gem and rvm tests.
If it is not available, the tests should be gracefully skipped.

From python runtests.py -u:

test__check_and_install_ruby (unit.states.rvm_test.TestRvmState) ... skipped 'mock python module is unavailable'
test__check_ruby (unit.states.rvm_test.TestRvmState) ... skipped 'mock python module is unavailable'
test__check_rvm (unit.states.rvm_test.TestRvmState) ... skipped 'mock python module is unavailable'
test_gemset_present (unit.states.rvm_test.TestRvmState) ... skipped 'mock python module is unavailable'
test_installed (unit.states.rvm_test.TestRvmState) ... skipped 'mock python module is unavailable'
test_installed (unit.states.gem_test.TestGemState) ... skipped 'mock python module is unavailable'
test_removed (unit.states.gem_test.TestGemState) ... skipped 'mock python module is unavailable'
test__rvm (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable'
test__rvm_do (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable'
test_gemset_list (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable'
test_gemset_list_all (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable'
test_install (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable'
test_list (unit.modules.rvm_test.TestRvmModule) ... skipped 'mock python module is unavailable'
test__gem (unit.modules.gem_test.TestGemModule) ... skipped 'mock python module is unavailable'
test_list (unit.modules.gem_test.TestGemModule) ... skipped 'mock python module is unavailable'
test_sources_list (unit.modules.gem_test.TestGemModule) ... skipped 'mock python module is unavailable'
2012-06-30 12:29:48 -07:00
Dan Colish
78d16a28f0 Move tmp hosts file management to test case which requires it. Fix
test.unit.utils.find_test on OSX
2012-06-30 12:20:53 -07:00
David Boucha
7e7d831103 Disable find unit tests on Windows
There are problems with pwd, grp and /dev/null
as they don't exist on Windows. So we are disabling
tests that use those for now.
2012-06-24 19:43:43 -06:00
David Boucha
bb72a4dfba Fix jinja_test on Windows 2012-06-24 18:16:22 -06:00
Jeroen Dekkers
92ffbaba6e Be compatible with mock 0.7 2012-06-19 02:19:03 +02:00
Baiju Muthukadan
8cc8fe7305 use sys.maxint for platform compatibility
Also comment out a failing test case.  This works in CentOS 6.2 32bit
but not working unde Ubuntu 12.04 32bit.
2012-06-18 12:06:54 +05:30
Baiju Muthukadan
ea4c519e25 tests for find utility 2012-06-18 00:54:48 +05:30
L.C. Rees
140e8781df - py3k updates 2012-05-31 23:31:27 -06:00
Dan Colish
f5c8e242e4 Refactor runtests to allow dotted path module discovery.
In addition to traditional file system path test discovery it is
useful to run a test by stating it's dotted python path. For example,
this will only run the cmdmod integration tests from the
module suite::

        $ runtests.py -n tests.integration.modules.cmdmod
2012-05-29 19:56:47 -07:00
Baiju Muthukadan
24bb4ea4e0 Fix PEP8 warnings for test cases 2012-05-29 22:10:20 +05:30
Jeff Schroeder
6f836afafa Remove a few instances of hardcoded /tmp in code
tempfile.gettempdir() is way better. The gem and rvm states are
still failing, but only because they require the "mock" python
module for running their tests.
2012-05-09 21:29:05 -07:00
Anselm Helbig
d02f0beaee added proper unit tests for gem and rvm modules and states; fixed bugs in the rvm module's install function and in the rvm state's handling of ruby versions 2012-05-03 11:33:16 +02:00
Anselm Helbig
5bc9ea7d67 added preliminary unit tests for rvm module 2012-05-02 09:42:01 +02:00
Eivind Uggedal
ab7ace6aa5 Split out integration tests from pure unit tests.
Integration tests requiring a salt master and daemon were seperated
from pure unit tests. For now both are run with runtest.py. In
the future it could take arguments for which type of tests to run.
2012-02-20 13:18:13 +01:00