Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:import testing framework for few tools scripts #4130

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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