You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
420 B
Go
18 lines
420 B
Go
package commands
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCalculateContainerCPUPercentage(t *testing.T) {
|
|
container := &ContainerStats{}
|
|
container.CPUStats.CPUUsage.TotalUsage = 10
|
|
container.CPUStats.SystemCPUUsage = 10
|
|
container.PrecpuStats.CPUUsage.TotalUsage = 5
|
|
container.PrecpuStats.SystemCPUUsage = 2
|
|
|
|
assert.EqualValues(t, 62.5, container.CalculateContainerCPUPercentage())
|
|
}
|