Skip to content

Commit 86e1171

Browse files
authored
[dvs] Re-add copy_file method to DVS (#1507)
I re-added the copy_file method that was removed in a recent refactor. Buildimage tests depend on this method, so subsequent submodule updates will fail. Signed-off-by: Danny Allen <[email protected]>
1 parent fcb6c9d commit 86e1171

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/conftest.py

+13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import string
1010
import subprocess
1111
import sys
12+
import tarfile
13+
import io
1214

1315
from typing import Dict, Tuple
1416
from datetime import datetime
@@ -532,6 +534,17 @@ def runcmd(self, cmd: str) -> Tuple[int, str]:
532534

533535
return (exitcode, out)
534536

537+
# used in buildimage tests, do not delete
538+
def copy_file(self, path: str, filename: str) -> None:
539+
tarstr = io.BytesIO()
540+
tar = tarfile.open(fileobj=tarstr, mode="w")
541+
tar.add(filename, os.path.basename(filename))
542+
tar.close()
543+
544+
self.ctn.exec_run(f"mkdir -p {path}")
545+
self.ctn.put_archive(path, tarstr.getvalue())
546+
tarstr.close()
547+
535548
def get_logs(self) -> None:
536549
log_dir = os.path.join("log", self.log_path) if self.log_path else "log"
537550

0 commit comments

Comments
 (0)