1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/openeuler-stratovirt

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Это зеркальный репозиторий, синхронизируется ежедневно с исходного репозитория.
В этом репозитории не указан файл с открытой лицензией (LICENSE). При использовании обратитесь к конкретному описанию проекта и его зависимостям в коде.
Клонировать/Скачать
Внести вклад в разработку кода
Синхронизировать код
Отмена
Подсказка: Поскольку Git не поддерживает пустые директории, создание директории приведёт к созданию пустого файла .keep.
Loading...
README.md

Hydropper:

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.

How to start

Preparation

  1. Ensure that python3 has been installed on your openEuler system.

  2. The requirements.txt file contains the Python3 dependency package.

  • pytest>5.0.0
  • aexpect>1.5.0
  • retrying

You can install these packages by running the following commands:

$ pip3 install -r requirements.txt
  1. Network dependency package:
$ yum install nmap
$ yum install iperf3
$ yum install bridge-utils
  1. Network configuration(template)
brctl addbr strato_br0
ip link set strato_br0 up
ip address add 1.1.1.1 dev strato_br0
  1. For details about how to build a test image, see docs/IMAGE_BUILD.md.

Parameter configuration

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

Run testcases

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 new testcases

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()

Log

  • pytest default log path: /var/log/pytest.log
  • stratovirt default log path: /var/log/stratovirt

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/openeuler-stratovirt.git
git@gitlife.ru:oschina-mirror/openeuler-stratovirt.git
oschina-mirror
openeuler-stratovirt
openeuler-stratovirt
v2.2.0-rc6