]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology: Add tests for seek and sync in write_file 2010/head
authorChristopher Hoffman <choffman@redhat.com>
Mon, 6 Jan 2025 14:44:49 +0000 (14:44 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Mon, 6 Jan 2025 15:58:05 +0000 (15:58 +0000)
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
teuthology/orchestra/test/test_remote.py

index a953835e7c0d63d18319c55202fe86212728b15f..ef9fb4406a592b12d44866d833127f5af5c2545e 100644 (file)
@@ -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)