Skip to content

Commit

Permalink
teuthology: Add tests for seek and sync in write_file
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Hoffman <[email protected]>
  • Loading branch information
chrisphoffman committed Jan 6, 2025
1 parent 0cef10d commit 0e0d40a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions teuthology/orchestra/test/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,15 @@ def test_is_container(self):
rem2 = remote.Remote(name='[email protected]', 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='[email protected]', 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)

0 comments on commit 0e0d40a

Please sign in to comment.