mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-21 16:57:08 +00:00
tests: Add a simple test to check the VMM vcpu allocation
As we've done some changes in the VMM vcpu allocation, let's introduce basic tests to make sure that we're getting the expected behaviour. The test consists in checking 3 scenarios: * default_vcpus = 0 | no limits set * this should allocate 1 vcpu * default_vcpus = 0.75 | limits set to 0.25 * this should allocate 1 vcpu * default_vcpus = 0.75 | limits set to 1.2 * this should allocate 2 vcpus The tests are very basic, but they do ensure we're rounding things up to what the new logic is supposed to do. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#
|
||||
# Copyright (c) 2023 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: vcpus-less-than-one-with-no-limits
|
||||
annotations:
|
||||
io.katacontainers.config.hypervisor.default_vcpus: "0"
|
||||
spec:
|
||||
runtimeClassName: kata
|
||||
containers:
|
||||
- name: vcpus-less-than-one-with-no-limits
|
||||
image: quay.io/prometheus/busybox:latest
|
||||
command: ['nproc', '--all']
|
||||
restartPolicy: Never
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: vcpus-less-than-one-with-limits
|
||||
annotations:
|
||||
io.katacontainers.config.hypervisor.default_vcpus: "0.75"
|
||||
spec:
|
||||
runtimeClassName: kata
|
||||
containers:
|
||||
- name: vcpus-less-than-one-with-limits
|
||||
image: quay.io/prometheus/busybox:latest
|
||||
resources:
|
||||
limits:
|
||||
cpu: "0.25"
|
||||
command: ['nproc', '--all']
|
||||
restartPolicy: Never
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: vcpus-more-than-one-with-limits
|
||||
annotations:
|
||||
io.katacontainers.config.hypervisor.default_vcpus: "0.75"
|
||||
spec:
|
||||
runtimeClassName: kata
|
||||
containers:
|
||||
- name: vcpus-more-than-one-with-limits
|
||||
image: quay.io/prometheus/busybox:latest
|
||||
resources:
|
||||
limits:
|
||||
cpu: "1.2"
|
||||
command: ['nproc', '--all']
|
||||
restartPolicy: Never
|
||||
---
|
Reference in New Issue
Block a user