Commit Graph

123 Commits

Author SHA1 Message Date
Pedro Algarvio
3ff77c1958 Wait for the integration tests local client cmd's for, at most, 30 seconds. 2013-01-13 12:49:10 +00:00
Pedro Algarvio
633a313587 Lower integration tests local client timeout to 5 minutes. 2013-01-13 11:31:04 +00:00
Pedro Algarvio
fd2739401c Adapt to the new local client events changes. Fixes #3214. 2013-01-11 19:03:53 +00:00
Pedro Algarvio
39f03c59cd The test suite local client now properly receives the events. Fixes #3214.
* We were instantiating the integration testing local client too soon in the process. Deferring it to a little latter made it all work.
* Added the ability to dump the master and minion testing configurations to files. Just prepend the `runtests` call with `DUMP_SALT_CONFIG=1` and you'll get the computed configuration files in `/tmp/salttest/{master,minion}`.
* We now also un-subscribe from the event's once done.
* Added `salt.utils.event.LocalClientEvent` just to differentiate from `salt.utils.event.MasterEvent` in the logs so we know who's who. It's just a subclass of the latter.
2013-01-11 16:21:04 +00:00
Thomas S Hatch
d95a8e612f clean up some double quotes 2013-01-10 00:25:02 -07:00
Ryan Schneider
8f8cc74b34 Some minor cleanup of unit and integration tests. 2012-12-18 17:39:16 -08:00
Pedro Algarvio
c0455f8fa9 Support creating state files at runtime.
We now support runtime created files that can be used like `salt://my-temp-file.txt`.
Just make sure you write them to `os.path.join(integration.TMP_STATE_TREE, 'my-temp-file.txt')`.
2012-12-12 18:38:39 +00:00
Pedro Algarvio
952779aa26 More code reuse in SaltReturnAssertsMixIn.
The methods `assertSaltTrueReturn`, `assertSaltFalseReturn` and `assertSaltNoneReturn` now reuse the code from `__getWithinSaltReturn` making `__assertReturn` obsolete and for that removed.
2012-12-12 17:11:44 +00:00
Pedro Algarvio
b9e72e7c3c Abstract SaltReturnAssertsMixIn to allow more tests using it.
* Created a method which gets a deep keyed value in a salt state return. For example, allow getting, `ret['changes']['new']`.
* Created a method which tries to make sure the correct type of the passed keys for the above added method.
* Also added were the methods, `assertInSaltReturn`, `assertNotInSaltReturn`, `assertInSaltReturnRegexpMatches`, which simplified the existing `assertInSaltComment`, `assertNotInSaltComment`, `assertSaltCommentRegexpMatches`, `assertSaltStateChangesEqual` and `assertSaltStateChangesNotEqual`, also allowing to do similar tests in every key(deep or not) of a salt state return dictionary.
2012-12-12 13:38:03 +00:00
Pedro Algarvio
7c6feb8c18 Fix a bug! It's basestring not string. 2012-12-12 00:33:54 +00:00
Pedro Algarvio
0baa63c19f Remove deprecated tests functions.
Removed `ModuleCase.assert_success()` and `ModuleCase.state_result()` which are now better tested using `SaltReturnAssertsMixIn`
2012-12-07 17:09:11 +00:00
Pedro Algarvio
fc3b272809 Migrated test.integration.states.pip to use SaltReturnAssertsMixIn.
* Added `assertSaltCommentRegexpMatches()` to `SaltReturnAssertsMixIn` to add the ability to match salt comments using regular expressions.
2012-12-07 16:59:24 +00:00
Pedro Algarvio
4b1747468b Adapted tests.integration.states.ssh to use SaltReturnAssertsMixIn.
* Two new methods were added to `SaltReturnAssertsMixIn`, `SaltReturnAssertsMixIn.assertSaltStateChangesEqual()` and `SaltReturnAssertsMixIn.assertSaltStateChangesNotEqual()`, in order to be able to test salt state returns. These methods, besides asserting that the state was correctly applied using `SaltReturnAssertsMixIn.assertSaltTrueReturn()`, are also able to test for what's in the `changes` key of salt's return, it can even "go inside" the `changes` dictionary, just have a look at what was done in `tests.integration.states.ssh`.
2012-12-07 12:46:02 +00:00
Pedro Algarvio
2d15b79114 Fix sync minions Process target. Correct sync'ed output. 2012-12-04 17:36:45 +00:00
Pedro Algarvio
65094c744a Stop using py27_subprocess under python 2.6 2012-12-04 16:29:53 +00:00
Pedro Algarvio
42799e0953 Fix '--clean/--no-clean' logic needed to sync minions. 2012-12-04 13:36:33 +00:00
Pedro Algarvio
f66c7741ff Allow more time for minions to sync. 2012-12-04 13:02:56 +00:00
Pedro Algarvio
a004639b99 Reuse getting a local client code with SaltClientTestCaseMixIn. 2012-12-04 11:51:37 +00:00
Pedro Algarvio
08aaecee12 Merge branch 'develop' of github.com:saltstack/salt into hotfix/gdb-resources 2012-12-04 00:55:50 +00:00
Pedro Algarvio
b0f594f452 run_script timeout's are not supported under windows. 2012-12-03 23:58:08 +00:00
Pedro Algarvio
3b0388c8f4 Merge branch 'develop' of github.com:saltstack/salt into hotfix/gdb-resources 2012-12-03 23:42:23 +00:00
Pedro Algarvio
b866ca3af0 Just detach from parent group. 2012-12-03 23:41:45 +00:00
Pedro Algarvio
5d274e8b7d Let's keep using multiprocessing. 2012-12-03 23:35:32 +00:00
Pedro Algarvio
7b10a7cd64 Merge branch 'develop' of github.com:saltstack/salt into hotfix/gdb-resources 2012-12-03 23:31:29 +00:00
Pedro Algarvio
a9669acf3a Kill tests run_script shell and it's children. 2012-12-03 23:30:21 +00:00
Pedro Algarvio
c89a6788f4 Is this what's needed under python 2.6 for tests to complete? 2012-12-03 21:07:51 +00:00
Pedro Algarvio
c4e485a8bf Allow setting a max time for a test run_script to execute and return. 2012-12-01 22:58:19 +00:00
Pedro Algarvio
c9cb4c220c Only sync minions modules if they're not already up to date. 2012-12-01 18:12:59 +00:00
Pedro Algarvio
d4005bee3d We now warn the users about misusing mode in file.recurse. Fixes #2726.
* Extended `SaltReturnAssertsMixIn` by adding `assertNotInSaltComment`.
* Fixed minor `tab` instead of spaces in `salt.states.file` code.
2012-11-28 17:57:44 +00:00
Pedro Algarvio
c782eae106 Extended SaltReturnAssertsMixIn and included a test case which triggers #2726.
* Extended `SaltReturnAssertsMixIn`, `assertInSaltComment`, which allows to see if a string is in a salt's returned comment.
2012-11-28 17:35:25 +00:00
Pedro Algarvio
bd552ef4a8 Migrate some of the Vagrant branch improved minions wait and sync code. 2012-11-26 05:44:18 +00:00
Pedro Algarvio
74aeeab5e5 Add some color when a test minion connects(trigger a Travis build). 2012-11-26 04:32:25 +00:00
Pedro Algarvio
fd283e9689 Improved SaltReturnAssertsMixIn.
* Added `assertReturnSaltType` which is dictionary for non errors.
* Added `assertReturnNonEmptySaltType` which does the above and makes sure it's not empty.
* Fix `tests.integration.states.user.UserTest` which was using wrongly using `assertSaltTrueReturn` on 'user.info' calls.
2012-11-25 22:29:08 +00:00
Pedro Algarvio
ee8a4faccc Make sure that parts are also dictionaries. 2012-11-25 20:11:24 +00:00
Pedro Algarvio
a6fd9bb60f Add tests.saltunittest.RedirectStdStreams.
* The `RedirectStdStreams` tests helper will allow to temporarily catch `stdout` and `stderr` output. Right now it's only used to **mute** the `tests.integration.runners.jobs.ManageTest.test_active()` output.
2012-11-23 12:19:09 +00:00
Pedro Algarvio
cf03063bec Improve SaltReturnAssertsMixIn and move tests.integration.states.cmd to use it.
* Implement `SaltReturnAssertsMixIn.assertSaltNoneReturn` used in `tests.integration.states.cmd`.
* Migrate `tests.integration.states.cmd` to use `SaltReturnAssertsMixIn`.
2012-11-21 12:43:53 +00:00
Pedro Algarvio
1f03ba59f1 Extend tests.integration.SaltReturnAssertsMixIn.
* Do proper type checking for salt calls, ie, a dict should be returned, if not, it's a failure, usually errors come as lists, show that to the user.
* Iterate through the salt call parts to make sure result is true, and if not, fail showing the part comment.
2012-11-21 12:16:17 +00:00
Pedro Algarvio
04146f39f9 Tests wait timer is now colored(option to disable colors is also available), improves readability. 2012-11-21 10:01:45 +00:00
Pedro Algarvio
eda67f0110 Show salt comment on assertTrue(ret['result']) failed calls.
* Created a mix which tests for the required assertion(True/False) and in case of a failure, shows salt comment kwarg in the raised assertion error so we know what was the original(salt's) failure.
2012-11-20 16:09:57 +00:00
Pedro Algarvio
09eb92ad8a Only import what's needed, cleans up code. 2012-11-19 01:21:06 +00:00
Pedro Algarvio
6a6f256472 Make it, actually work, on python 2.6 2012-11-19 01:13:29 +00:00
Pedro Algarvio
c6dcdbe6dc Hardcore approach to travis-ci failures under python 2.6.
* We basically copied subprocess from python 2.7 and import that one instead of the python 2.6 subprocess to run the tests. Since we import it under a different name, there should be no issues with the remaining of salt's source importing the regular subprocess module.
2012-11-18 23:49:37 +00:00
Pedro Algarvio
f67d24cf30 Minor cosmetic change. 2012-11-17 17:43:23 +00:00
Pedro Algarvio
5bf4549777 Use actual time, to reduce time.sleep() inaccuracy. 2012-11-17 17:37:53 +00:00
Pedro Algarvio
d3e0d64068 Show a nice clock counter while we wait for the sync job to finish. 2012-11-09 15:25:16 +00:00
Pedro Algarvio
cae00911a5 One more try to properly handle the process termination. 2012-11-07 14:10:02 +00:00
Pedro Algarvio
b4f2ad2884 Never fail on process.terminate() since the process is supposed to have ended. 2012-11-07 13:58:44 +00:00
Pedro Algarvio
8e9fd09eeb Try to cleanup after ourselves.
* Only instantiate a `LocalClient` on a test if one is required.
* Try to precipitate garbage collection on our minions connect and sync multi-processes.
2012-11-07 13:40:39 +00:00
Pedro Algarvio
c5c637154a Try to get some system information out of Travis-CI. 2012-11-06 18:11:26 +00:00
Pedro Algarvio
af7ebf12f8 Try not to fail on travis-ci under python 2.6
* Raised max open files by 1024 since running in a vagrant machine 2048 was not enough, though, I think travis-ci defaults to a higher value.
* Wait a bit longer on the events testing.
* Separated the initial minions connected and minions synced into two different events and functions. Also corrected the `if` expected value when a timeout occurs.
2012-11-06 16:02:36 +00:00