Skip to content

Commit

Permalink
test: move fixture to avoid spurious build
Browse files Browse the repository at this point in the history
Move the fixture so that it is only evaluated if we are running
functional tests.

Signed-off-by: Pablo Barbáchano <pablob@amazon.com>
  • Loading branch information
pb8o committed Mar 15, 2024
1 parent 59ff7a2 commit ab5367c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
10 changes: 1 addition & 9 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import host_tools.cargo_build as build_tools
from framework import defs, utils
from framework.artifacts import firecracker_artifacts, kernel_params, rootfs_params
from framework.artifacts import kernel_params, rootfs_params
from framework.microvm import MicroVMFactory
from framework.properties import global_props
from framework.utils_cpu_templates import (
Expand Down Expand Up @@ -274,14 +274,6 @@ def microvm_factory(request, record_property, results_dir):
uvm_factory.kill()


@pytest.fixture(params=firecracker_artifacts())
def firecracker_release(request, record_property):
"""Return all supported firecracker binaries."""
firecracker = request.param
record_property("firecracker_release", firecracker.name)
return firecracker


@pytest.fixture(params=static_cpu_templates_params())
def cpu_template(request, record_property):
"""Return all static CPU templates supported by the vendor."""
Expand Down
18 changes: 18 additions & 0 deletions tests/integration_tests/functional/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

"""Imported by pytest when running tests in this directory"""

import pytest

from framework.artifacts import firecracker_artifacts


# This fixture forces a Firecracker build, even if it doesn't get used.
# By placing it here instead of the top-level conftest.py we skip the build.
@pytest.fixture(params=firecracker_artifacts())
def firecracker_release(request, record_property):
"""Return all supported firecracker binaries."""
firecracker = request.param
record_property("firecracker_release", firecracker.name)
return firecracker

0 comments on commit ab5367c

Please sign in to comment.