MCPcopy Index your code
hub / github.com/saltstack/salt / _test_lock

Function _test_lock

tests/pytests/functional/utils/gitfs/test_gitfs.py:244–273  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

242
243
244def _test_lock(opts):
245 g = _get_gitfs(
246 opts,
247 "https://github.com/saltstack/salt-test-pillar-gitfs.git",
248 )
249 g.fetch_remotes()
250 assert len(g.remotes) == 1
251 repo = g.remotes[0]
252 mach_id = _get_machine_identifier().get("machine_id", "no_machine_id_available")
253 assert repo.get_salt_working_dir() in repo._get_lock_file()
254 assert repo.lock() == (
255 [
256 (
257 f"Set update lock for gitfs remote "
258 f"'https://github.com/saltstack/salt-test-pillar-gitfs.git' on machine_id '{mach_id}'"
259 )
260 ],
261 [],
262 )
263 assert os.path.isfile(repo._get_lock_file())
264 assert repo.clear_lock() == (
265 [
266 (
267 f"Removed update lock for gitfs remote "
268 f"'https://github.com/saltstack/salt-test-pillar-gitfs.git' on machine_id '{mach_id}'"
269 )
270 ],
271 [],
272 )
273 assert not os.path.isfile(repo._get_lock_file())
274
275
276@skipif_no_gitpython

Callers 2

test_gitpython_lockFunction · 0.70
test_pygit2_lockFunction · 0.70

Calls 7

_get_gitfsFunction · 0.85
fetch_remotesMethod · 0.80
get_salt_working_dirMethod · 0.80
_get_lock_fileMethod · 0.80
getMethod · 0.45
lockMethod · 0.45
clear_lockMethod · 0.45

Tested by

no test coverage detected