Skip to content

Commit

Permalink
[dvs] Re-add copy_file method to DVS (sonic-net#1507)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
daall authored Nov 18, 2020
1 parent fcb6c9d commit 86e1171
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import string
import subprocess
import sys
import tarfile
import io

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

return (exitcode, out)

# used in buildimage tests, do not delete
def copy_file(self, path: str, filename: str) -> None:
tarstr = io.BytesIO()
tar = tarfile.open(fileobj=tarstr, mode="w")
tar.add(filename, os.path.basename(filename))
tar.close()

self.ctn.exec_run(f"mkdir -p {path}")
self.ctn.put_archive(path, tarstr.getvalue())
tarstr.close()

def get_logs(self) -> None:
log_dir = os.path.join("log", self.log_path) if self.log_path else "log"

Expand Down

0 comments on commit 86e1171

Please sign in to comment.