@@ -497,39 +497,6 @@ def test_microvm_any(request, microvm):
497
497
yield microvm
498
498
499
499
500
- @pytest .fixture
501
- def test_multiple_microvms (test_fc_session_root_path , context , bin_cloner_path ):
502
- """Yield one or more microvms based on the context provided.
503
-
504
- `context` is a dynamically parameterized fixture created inside the special
505
- function `pytest_generate_tests` and it holds a tuple containing the name
506
- of the guest image used to spawn a microvm and the number of microvms
507
- to spawn.
508
- """
509
- microvms = []
510
- (microvm_resources , how_many ) = context
511
-
512
- # When the context specifies multiple microvms, we use the first vm to
513
- # populate the other ones by hardlinking its resources.
514
- first_vm = init_microvm (test_fc_session_root_path , bin_cloner_path )
515
- MICROVM_S3_FETCHER .init_vm_resources (microvm_resources , first_vm )
516
- microvms .append (first_vm )
517
-
518
- # It is safe to do this as the dynamically generated fixture `context`
519
- # asserts that the `how_many` parameter is always positive
520
- # (i.e strictly greater than 0).
521
- for _ in range (how_many - 1 ):
522
- vm = init_microvm (test_fc_session_root_path , bin_cloner_path )
523
- MICROVM_S3_FETCHER .hardlink_vm_resources (microvm_resources , first_vm , vm )
524
- microvms .append (vm )
525
-
526
- yield microvms
527
-
528
- for i in range (how_many ):
529
- microvms [i ].kill ()
530
- shutil .rmtree (os .path .join (test_fc_session_root_path , microvms [i ].id ))
531
-
532
-
533
500
@pytest .fixture (autouse = True , scope = "session" )
534
501
def test_spectre_mitigations ():
535
502
"""Check the kernel is compiled with SPECTREv2 mitigations."""
@@ -582,45 +549,6 @@ def firecracker_release(request):
582
549
return firecracker
583
550
584
551
585
- def pytest_generate_tests (metafunc ):
586
- """Implement customized parametrization scheme.
587
-
588
- This is a special hook which is called by the pytest infrastructure when
589
- collecting a test function. The `metafunc` contains the requesting test
590
- context. Amongst other things, the `metafunc` provides the list of fixture
591
- names that the calling test function is using. If we find a fixture that
592
- is called `context`, we check the calling function through the
593
- `metafunc.function` field for the `_pool_size` attribute which we
594
- previously set with a decorator. Then we create the list of parameters
595
- for this fixture.
596
- The parameter will be a list of tuples of the form (cap, pool_size).
597
- For each parameter from the list (i.e. tuple) a different test case
598
- scenario will be created.
599
- """
600
- if "context" in metafunc .fixturenames :
601
- # In order to create the params for the current fixture, we need the
602
- # capability and the number of vms we want to spawn.
603
-
604
- # 1. Look if the test function set the pool size through the decorator.
605
- # If it did not, we set it to 1.
606
- how_many = int (getattr (metafunc .function , "_pool_size" , None ))
607
- assert how_many > 0
608
-
609
- # 2. Check if the test function set the capability field through
610
- # the decorator. If it did not, we set it to any.
611
- cap = getattr (metafunc .function , "_capability" , "*" )
612
-
613
- # 3. Before parametrization, get the list of images that have the
614
- # desired capability. By parametrize-ing the fixture with it, we
615
- # trigger tests cases for each of them.
616
- image_list = MICROVM_S3_FETCHER .list_microvm_images (capability_filter = [cap ])
617
- metafunc .parametrize (
618
- "context" ,
619
- [(item , how_many ) for item in image_list ],
620
- ids = ["{}, {} instance(s)" .format (item , how_many ) for item in image_list ],
621
- )
622
-
623
-
624
552
@pytest .fixture (params = ARTIFACTS_COLLECTION .kernels (), ids = lambda kernel : kernel .name ())
625
553
def guest_kernel (request ):
626
554
"""Return all supported guest kernels."""
0 commit comments