Commit Graph

63 Commits

Author SHA1 Message Date
Pedro Algarvio
d05028e88c
These are not integration tests 2017-04-01 14:22:51 +01:00
Nicole Thomas
2714676a13 Merge pull request #39746 from terminalmage/pathutils
Add salt.utils.path
2017-03-14 11:00:34 -06:00
Erik Johnson
db5208b65a Set up special file_roots for windows symlink test 2017-03-10 11:05:02 -06:00
Pedro Algarvio
07d0a5ed20
Cleanup after ourselves 2017-03-08 18:34:32 +00:00
Pedro Algarvio
519a3f689e
These tests are not destructive 2017-03-02 19:56:06 +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
15af4c9728
Test filenames conformity. Adjust for pytest. 2017-02-23 23:19:42 +00:00
twangboy
db645da0bf Fix fileserver roots tests for Windows 2017-02-22 16:53:27 -07:00
rallytime
dda39d4e63 Merge branch '2016.11' into 'develop'
Conflicts:
  - salt/minion.py
  - salt/modules/file.py
  - salt/modules/grains.py
  - salt/utils/gitfs.py
2017-02-16 12:18:46 -07:00
rallytime
6d78adbf08 Merge branch '2016.3' into '2016.11'
Conflicts:
  - doc/topics/tutorials/gitfs.rst
  - salt/fileserver/roots.py
  - salt/loader.py
2017-02-15 10:35:02 -07:00
Erik Johnson
4ff13acf8b salt.fileserver.roots: Fix regression in symlink_list (#39409)
A recent PR of mine removed the logic in symlink_list and fell back to
the cached file list generated in _file_lists(). However, this code
dates back from before the fileserver backends' symlink_list() functions
were modified to return a dict mapping links to their destinations.

This fixes the code in _file_lists() so that it returns the correct
data. It also fixes the fact that '.' was showing up in the dir list
produced by _file_lists(), and updates the associated integration test
to include the cachedir in the mocked opts.
2017-02-15 10:06:17 -07:00
Pedro Algarvio
fc59d5e832 Python 3 Fixes (Pt. 2) (#39397)
* Typo in comment

* First convert to string if not already a string. Then to bytes under Py3.

The reason being that jids from the CLI, at least the one fed in
integration.runners.jobs.ManageTest.test_loopup_jid is loaded as an
integer, and, while the Py2 code converts JIDs to strings, under Py3, we
assume JID's are already strings.

* Mark tests which require root permissions to run

* Allow declaring that the function IS a class method.

```
Python 3.5.3 (default, Jan 21 2017, 00:29:12)
[GCC 6.3.1 20170109] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
...     def bar(self):
...         print('bar')
...
>>> import inspect
>>> inspect.ismethod(Foo.bar)
False
>>> inspect.ismethod(Foo().bar)
True
```

On Python 2, `inspect.ismethod` returns `True` for bound and unbound
methods while on Python 3 it only returns `True` for bound methods.
The explicit `is_class_method` is to avoid instantiating the class just
to get the function signature.

* Always decode responses to the Python version native string implementation

* Just compare the objects as matching list.

Asserting same item count doesn't make that much sense.

* Py3 compatibility

* Fix saltnado tests under Py3

* Python 3 compatibility

* Show me the full traceback

* Revert "Convert fileserver data from bytes to strings"

This reverts commit e53972f8c6.

* Revert "Under Py3, we get `bytes` when using the roots backend directly"

This reverts commit 9f73b240c1.

* Convert from bytes to str if not a binary file

* Py3 compatibility fixes.

Convert file contents from bytes to string if not a binary file
2017-02-14 16:20:56 -07:00
Pedro Algarvio
9f73b240c1
Under Py3, we get bytes when using the roots backend directly 2017-02-13 16:44:30 +00:00
Erik Johnson
d35c2f810c salt.utils.gitfs: remove dulwich support, make refspecs configurable (#39210)
* Add config params for custom refspecs

* Add exceptions for errors encountered modifying git config

* Make the refspecs a configurable parameter

* Make refspecs a per-remote parameter

* Update master config template to include custom refspecs opts

* Add documentation for new config params

* Update GitFS walkthrough with a section on custom refspecs

* Remove dulwich support from salt.utils.gitfs

Dulwich still lacks important features, including (but not limited to)
the following:

- Lack of the necessary support for checking out a ref needed for
  git_pillar/winrepo support

- No support in its config objects for multivar git config items, making
  it impossible to detect when repos have multiple refspecs set for a
  given git remote

Given this information, and the fact that it trails as a distant third
to Pygit2 and GitPython, Salt will cease to support Dulwich as a git
interface moving forward.

* Excise references to dulwich from documentation

* Add mention of custom refspecs to Nitrogen release notes

* Add gitfs_refspecs to mocked opts in gitfs integration tests

Also remove dulwich from unit tests

* Add information about opts argument not being intended for CLI use
2017-02-09 09:50:45 -07:00
rallytime
a782b00ee1 Merge branch '2016.3' into '2016.11'
Conflicts:
  - salt/cloud/clouds/openstack.py
2017-02-01 13:35:10 -07:00
Erik Johnson
bcee3d1ef6 Move fileclient tests to tests/integration/fileserver/fileclient_test.py (#39081)
Being in the root of tests/integration/, these were not being run in
jenkins and would only run if executed manually using the -n flag in
runtests.py.
2017-01-31 13:44:50 -07:00
Mihai Dinca
b0f0b4effc Make sha256 the default hash_type 2016-08-15 10:02:19 +02:00
Erik Johnson
58c4c01743 Add __role to master opts for gitfs integration tests 2016-02-02 21:58:50 -06:00
Erik Johnson
20c8badf4c Add __role to master opts for gitfs integration tests 2016-02-02 21:29:39 -06:00
Erik Johnson
a1ffa0c1c4 More test fixes 2015-07-22 10:40:49 -05:00
Erik Johnson
73192390a2 Test fixes 2015-07-22 00:48:43 -05:00
Mike Place
c5081179ef gitfs test lint fix 2015-02-10 14:57:28 -07:00
Mike Place
78309a0e2d Last time with find removed 2015-02-10 13:40:33 -07:00
Mike Place
dbd74fbeee Remove another test. 2015-02-10 11:54:16 -07:00
Mike Place
1e14c9d097 Disable gitfs test that does not produce valuable data 2015-02-10 10:06:01 -07:00
Pedro Algarvio
60f215f191 Add from __future__ import absolute_import 2015-01-30 22:25:04 +00:00
Pedro Algarvio
b32d86d0f4 Allow getting the configuration from scratch.
Properly handle `client_config` when loading from cache.
Only delete the `_client` attribute if it has been set.
2014-10-08 01:00:06 +01:00
Erik Johnson
ec07a8efea Get effective username using pwd.getpwduid() 2014-08-21 15:22:54 -05:00
Erik Johnson
43de873bb2 D'oh, needed to capitalize USERNAME 2014-08-21 14:35:36 -05:00
Erik Johnson
26a3db2ac8 Set USERNAME env var manually in test suite
This works around a known issue in GitPython when the USERNAME
environment variable is missing.
2014-08-21 12:19:31 -05:00
Erik Johnson
bf982d6893 Update gitfs test opts to reflect new gitfs config opts 2014-08-20 22:23:45 -05:00
Thomas S Hatch
da2f3543fd Skip gitfs tests
These are running in an incosistent way, all of our local tests pass
2014-07-11 15:17:58 -06:00
Erik Johnson
1fd16fa434 Refine gitfs tests
This adds a tearDown to ensure a clean copy of the repo for each test.
In addition, it removes the dependency on lexicographical order by
running a find_file() inside the two tests which require it in order to
ensure that the file exists in the gitfs cache.
2014-07-09 16:06:36 -06:00
Erik Johnson
d942c98ef6 Fix gitfs tests
This changes how the setUp function initializes and commits the repo
used as a gitfs remote by these tests. Instead of using the git.Git
class, it simply uses the index object to add and then commit. See here
for more info:

https://pythonhosted.org/GitPython/0.3.1/tutorial.html#the-index-object

Additionally, file_hash() and serve_file() are designed to check copies
of files that have been retrieved from the blobs, in
$cachedir/gitfs/refs/$saltenv/path/to/file. The paths have been fixed in
these two tests, and the sha1 test has been renamed to ensure that it is
executed after test_find_file, so that the file exists in the cache.
2014-07-08 18:56:12 -06:00
Mike Place
c4f5298d62 Create gitfs cache dir if does not exist
Should fix test suite
2014-06-17 12:04:53 -06:00
Mike Place
b278fcebff Use sha1 hash for gitfs tests 2014-06-16 16:16:57 -06:00
Pedro Algarvio
9e1634d386 Patch the gitfs opts with custom opts and not master opts.
It worked but this was, as it was, it's more explicit
2014-06-15 13:25:21 +01:00
Pedro Algarvio
0a10c4d2c7 Turns out all we needed was the correct load 2014-06-15 13:24:39 +01:00
Pedro Algarvio
79d7918271 Add missing path key to the load.
Minor PEP-8, global variable `load` -> `LOAD`
2014-06-15 13:18:36 +01:00
Pedro Algarvio
7b017fe9ab Skip test for now.
/CC: @cachedout
2014-06-15 13:05:19 +01:00
Pedro Algarvio
130788864f Skip tests on missing empty_dir 2014-06-15 13:05:19 +01:00
Pedro Algarvio
cf4a531e62 Fix ensure in syspath 2014-06-05 15:56:20 +01:00
Pedro Algarvio
81b93dc944 Skip tests which need the empty_dir.
These will run perfectly fine with the upcoming salt-runtests.
2014-06-05 11:54:07 +01:00
Pedro Algarvio
c3fbe4fe98 The cachedir configuration option needs to be set. 2014-06-05 11:10:24 +01:00
Pedro Algarvio
c8466453a0 Wrap text 2014-06-05 10:10:56 +01:00
Pedro Algarvio
ccbf2ebfb6 No hardcoded paths. Provide required additional configuration options. 2014-06-05 10:10:56 +01:00
Pedro Algarvio
649c7e6d01 Ensure proper path in syspath 2014-06-05 10:10:56 +01:00
Pedro Algarvio
36ea569d0d Don't use hard coded paths 2014-06-05 10:10:55 +01:00
Pedro Algarvio
af503bfdcf Skip test if unable to import the git python package 2014-06-01 07:05:52 +01:00