Commit Graph

19 Commits

Author SHA1 Message Date
Erik Johnson
f9f187e915
Improve reliability/idempotence of file.blockreplace state
This makes the following changes:

- The `append_newline` argument to the `file.blockreplace`
  remote-execution function has been modified so that if its value is
  `None`, it only appends a newline when the content block does not end
  in one.
- A couple of fixes were made to newline handling. The existing code
  normalized the newlines in the content block, replacing them with
  os.linesep. However, when the file contains newlines that don't match
  the OS (i.e. POSIX newlines in a file on a Windows box, or Windows
  newlines on a Linux/Mac/BSD/etc. box), then we would still end up with
  mixed newlines. The line separator is now detected when we read in the
  original file, and the detected line separator is used when writing
  the content block. Additionally, the same newline mismatch was
  possible when appending/prepending the content block. This has been
  fixed by using a common function for appending, prepending, and
  replacing the content block.
- Support for the `append_newline` argument has been added to the
  `file.blockreplace` state. The default value for the state is `None`.
  A `versionchanged` has been added to the remote execution function to
  let users know that the Fluorine release will change the default value
  of that variable.
- 20 new integration tests have been written to test the
  `file.blockreplace` state.
2018-03-07 22:29:39 -06:00
Daniel Wallace
f309bae8b4 Make sure runtests_engine is ASCII text
If this is has any unicode characters in it, it won't load on systems that do
not default to a unicode locale.

find . -type f | while read line; do ret=$(file $line); if [[ $ret == *UTF-8* && $line == *.py ]]; then echo $line; fi; done

The above will list all files that have unicode characters in it and won't load
with locale set to C or POSIX
2017-06-05 17:30:28 -06:00
Erik Johnson
3881b6e0f3 Prepare git_pillar test code for adding HTTP tests
This further abstracts some of the setup and teardown code so it can be
used for git-over-http tests.

It also moves the code that was originally added to the archive
state integration tests to create a local http server into
salt.support.helpers so that it can be more easily and portably used.
2017-04-24 11:00:39 -05:00
Pedro Algarvio
c3417213d7
Make sure the socket's used are closed 2017-04-04 19:28:06 +01:00
Pedro Algarvio
61003bca0a
Take care of resource leakage on tests 2017-04-04 18:58:20 +01:00
Pedro Algarvio
42e35e13cc
Use mock to patch 2017-04-04 18:58:20 +01:00
Pedro Algarvio
9af2ca8823
No need to load all modules docs.
This should reduce memory usage as well as speeding up the decorator
2017-04-04 18:04:38 +01:00
Pedro Algarvio
6fe53339ce
Gate class definitions 2017-03-11 19:46:23 +00:00
Pedro Algarvio
992a8c7294
Don't hardcode the webserver port number 2017-03-11 16:00:28 +00:00
Pedro Algarvio
df942bc082
Add a repeat decorator to retry passing tests N times until it fails 2017-03-08 18:34:33 +00:00
Pedro Algarvio
07d0a5ed20
Cleanup after ourselves 2017-03-08 18:34:32 +00:00
Pedro Algarvio
ffec7dc299
Lint fixes 2017-03-06 14:35:16 +00:00
Pedro Algarvio
5e3309d5f8
Let's use the skip_if_not_root decorator instead 2017-03-02 19:58:10 +00:00
Pedro Algarvio
96bcaf5365
The order is shady under Py3
/cc @cachedout @rallytime
2017-03-02 19:56:05 +00:00
Pedro Algarvio
ab83cced63
Child processes termination cleanup 2017-03-01 01:33:07 +00:00
Pedro Algarvio
40a64191a1
Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
Pedro Algarvio
3beb3fb801
Move whatever we need from salttesting to salt.
Let's drop the salttesting dependency cycle.
2017-02-28 22:52:49 +00:00
Pedro Algarvio
53eff91efa
Re-enable the test since we now have the flaky decorator 2017-02-28 22:52:48 +00:00
Pedro Algarvio
2a9d2beb02
The order is shady under Py3
/cc @cachedout @rallytime
2017-02-28 22:52:48 +00:00