Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bindings/python: Fix call to create a symlink #1934

Merged
merged 2 commits into from
Jan 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bindings/python/flux/kvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ def put_unlink(flux_handle, key):
return RAW.flux_kvs_txn_unlink(flux_handle.aux_txn, 0, key)


def put_symlink(flux_handle, key):
def put_symlink(flux_handle, key, target):
if flux_handle.aux_txn is None:
flux_handle.aux_txn = RAW.flux_kvs_txn_create()
return RAW.flux_kvs_txn_symlink(flux_handle.aux_txn, 0, key)
return RAW.flux_kvs_txn_symlink(flux_handle.aux_txn, 0, key, target)


def commit(flux_handle, flags=0):
Expand Down
17 changes: 17 additions & 0 deletions t/python/t0005-kvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,23 @@ def test_walk(self):
for r, ds, fs in walk_gen:
pass

def test_put_mkdir(self):
flux.kvs.put_mkdir(self.f, "txn_mkdir")
flux.kvs.commit(self.f)
self.assertTrue(flux.kvs.exists(self.f, "txn_mkdir"))

def test_put_unlink(self):
flux.kvs.put(self.f, "txn_unlink", 1)
flux.kvs.commit(self.f)
flux.kvs.put_unlink(self.f, "txn_unlink")
flux.kvs.commit(self.f)
self.assertFalse(flux.kvs.exists(self.f, "txn_unlink"))

def test_put_symlink(self):
flux.kvs.put_symlink(self.f, "txn_symlink", "txn_target")
flux.kvs.commit(self.f)
self.assertFalse(flux.kvs.exists(self.f, "txn_symlink"))


if __name__ == "__main__":
if rerun_under_flux(__flux_size()):
Expand Down