Hydropper is a lightweight test framework based on pytest. It encapsulates virtualization-related test atoms and is used for stratovirt black-box tests.Hydropper has provided some testcases for lightweight virtualization and standard virtualization to help Developers find and locate Stratovirt problems.
Ensure that python3 has been installed on your openEuler system.
The requirements.txt file contains the Python3 dependency package.
You can install these packages by running the following commands:
$ pip3 install -r requirements.txt
$ yum install nmap
$ yum install iperf3
$ yum install bridge-utils
brctl addbr strato_br0
ip link set strato_br0 up
ip address add 1.1.1.1 dev strato_br0
Set parameters and corresponding paths in the config/config.ini. Generally, the kernel and rootfs must be configured for test cases.
[env.params]
...
VM_USERNAME = <usrname>
VM_PASSWORD = <passwd>
...
[stratovirt.params]
...
STRATOVIRT_VMLINUX = /path/to/kernel
STRATOVIRT_ROOTFS = /path/to/rootfs
...
Configure IP_PREFIX and IP_3RD in the "config.ini" file, which indicate the first 24 bits of the VM IPv4 address, The last 8 bits are automatically configured by the hydropper. Note that the VM and the host must be in the same network segment.
[network.params]
# such as 'IP_PREFIX.xxx.xxx'
IP_PREFIX = 1.1
# such as 'xxx.xxx.IP_3RD.xxx'
IP_3RD = 1
You can run the following commands in the hydroper directory to execute cases:
# Run all cases
$ pytest
# Run all cases with the keyword microvm
$ pytest -k microvm
# Run all cases in test_microvm_cmdline.py
$ pytest testcases/microvm/functional/test_microvm_cmdline.py
# Run test_microvm_without_daemonize
$ pytest testcases/microvm/functional/test_microvm_cmdline.py::test_microvm_without_daemonize
Add customized cases to the microvm directory under testcases.You can add a python file or add a function to an existing python file.The file name and function name must be in the format of test_*.
test_microvm_xxx.py
def test_microvm_xxx()
We have preset some virtual machine objects. You can test the virtual machine by generating their instances:
def test_microvm_xxx(microvm):
test_vm = microvm
test_vm.launch()
In addition, Fixture is useful to write testcases.You can use Fixture in the following ways:
# Mark the tag to system
@pytest.mark.system
def test_microvm_xxx(microvm):
test_vm = microvm
test_vm.launch()
Now you can use the pytest -m system command to run all the "system" cases.
You can use the basic_config() function to configure VM parameters:
# Configure four vCPUs and 4 GB memory for the VM.
def test_microvm_xxx(microvm):
test_vm = microvm
test_vm.basic_config(vcpu_count=4, mem_size='4G')
test_vm.launch()
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Комментарий ( 0 )