From: Christopher Hoffman Date: Mon, 6 Jan 2025 14:44:49 +0000 (+0000) Subject: teuthology: Add tests for seek and sync in write_file X-Git-Tag: 1.2.2~45^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0e0d40a8a3e26b454d20fef51f5411d3231c123f;p=teuthology.git teuthology: Add tests for seek and sync in write_file Signed-off-by: Christopher Hoffman --- diff --git a/teuthology/orchestra/test/test_remote.py b/teuthology/orchestra/test/test_remote.py index a953835e7..ef9fb4406 100644 --- a/teuthology/orchestra/test/test_remote.py +++ b/teuthology/orchestra/test/test_remote.py @@ -220,3 +220,15 @@ class TestRemote(object): rem2 = remote.Remote(name='jdoe@xyzzy.example.com', ssh=self.m_ssh) rem2._runner = m_run assert not rem2.is_container + + @patch("teuthology.orchestra.remote.Remote.run") + def test_write_file(self, m_run): + file = "fakefile" + contents = "fakecontents" + rem = remote.Remote(name='jdoe@xyzzy.example.com', ssh=self.m_ssh) + + remote.Remote.write_file(rem, file, contents, bs=1, offset=1024) + m_run.assert_called_with(args=f"set -ex\ndd of={file} bs=1 seek=1024", stdin=contents, quiet=True) + + remote.Remote.write_file(rem, file, contents, sync=True) + m_run.assert_called_with(args=f"set -ex\ndd of={file} conv=sync", stdin=contents, quiet=True)