Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/firecracker
Path: blob/main/tests/integration_tests/functional/test_concurrency.py
1958 views
1
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
# SPDX-License-Identifier: Apache-2.0
3
"""Ensure multiple microVMs work correctly when spawned simultaneously."""
4
5
from framework import decorators
6
7
import host_tools.network as net_tools
8
9
NO_OF_MICROVMS = 20
10
11
12
@decorators.test_context('ssh', NO_OF_MICROVMS)
13
def test_run_concurrency(test_multiple_microvms, network_config):
14
"""Check we can spawn multiple microvms."""
15
microvms = test_multiple_microvms
16
17
for i in range(NO_OF_MICROVMS):
18
microvm = microvms[i]
19
_ = _configure_and_run(microvm, {
20
"config": network_config, "iface_id": str(i)
21
})
22
# We check that the vm is running by testing that the ssh does
23
# not time out.
24
_ = net_tools.SSHConnection(microvm.ssh_config)
25
26
27
def _configure_and_run(microvm, network_info):
28
"""Auxiliary function for configuring and running microVM."""
29
microvm.spawn()
30
31
# Machine configuration specified in the SLA.
32
config = {
33
'vcpu_count': 1,
34
'mem_size_mib': 128
35
}
36
37
microvm.basic_config(**config)
38
39
_tap, _, _ = microvm.ssh_network_config(
40
network_info["config"],
41
network_info["iface_id"]
42
)
43
44
microvm.start()
45
return _tap
46
47