Skip to content

Commit

Permalink
fix:import testing framework for few tools scripts
Browse files Browse the repository at this point in the history
rearrange changes added in #4089 so that the testing
framework is available and the tools scripts work as expected.

Signed-off-by: Sudan Landge <[email protected]>
  • Loading branch information
Sudan Landge authored and wearyzen committed Sep 25, 2023
1 parent 18c92c6 commit 71c56c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tools/create_snapshot_artifact/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@
import tempfile
from pathlib import Path

from host_tools.cargo_build import get_firecracker_binaries

# Hack to be able to import testing framework functions.
sys.path.append(os.path.join(os.getcwd(), "tests")) # noqa: E402

# pylint: disable=wrong-import-position
# The test infra assumes it is running from the `tests` directory.
os.chdir("tests")
from framework.artifacts import disks, kernels
from framework.defs import DEFAULT_TEST_SESSION_ROOT_PATH
from framework.microvm import MicroVMFactory
Expand All @@ -28,9 +24,9 @@
run_cmd,
)
from framework.utils_cpuid import CpuVendor, get_cpu_vendor
from host_tools.cargo_build import get_firecracker_binaries

# restore directory
os.chdir("..")
# pylint: enable=wrong-import-position

# Default IPv4 address to route MMDS requests.
IPV4_ADDRESS = "169.254.169.254"
Expand Down
8 changes: 8 additions & 0 deletions tools/test-popular-containers/test-docker-rootfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@
Test all the ext4 rootfs in the current directory
"""

import os
import sys
from pathlib import Path

# Hack to be able to import testing framework functions.
sys.path.append(os.path.join(os.getcwd(), "tests"))

# pylint: disable=wrong-import-position
from framework.artifacts import kernels
from framework.microvm import MicroVMFactory
from host_tools.cargo_build import get_firecracker_binaries

# pylint: enable=wrong-import-position

kernels = list(kernels("vmlinux-*"))
# Use the latest guest kernel
kernel = kernels[-1]
Expand Down

0 comments on commit 71c56c0

Please sign in to comment.