1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
//go:build !linux
// +build !linux
package memlimit
import (
"testing"
)
func TestFromCgroup(t *testing.T) {
limit, err := FromCgroup()
if err != ErrCgroupsNotSupported {
t.Fatalf("FromCgroup() error = %v, wantErr %v", err, ErrCgroupsNotSupported)
}
if limit != 0 {
t.Fatalf("FromCgroup() got = %v, want %v", limit, 0)
}
}
func TestFromCgroupV1(t *testing.T) {
limit, err := FromCgroupV1()
if err != ErrCgroupsNotSupported {
t.Fatalf("FromCgroupV1() error = %v, wantErr %v", err, ErrCgroupsNotSupported)
}
if limit != 0 {
t.Fatalf("FromCgroupV1() got = %v, want %v", limit, 0)
}
}
func TestFromCgroupHybrid(t *testing.T) {
limit, err := FromCgroupHybrid()
if err != ErrCgroupsNotSupported {
t.Fatalf("FromCgroupHybrid() error = %v, wantErr %v", err, ErrCgroupsNotSupported)
}
if limit != 0 {
t.Fatalf("FromCgroupHybrid() got = %v, want %v", limit, 0)
}
}
func TestFromCgroupV2(t *testing.T) {
limit, err := FromCgroupV2()
if err != ErrCgroupsNotSupported {
t.Fatalf("FromCgroupV2() error = %v, wantErr %v", err, ErrCgroupsNotSupported)
}
if limit != 0 {
t.Fatalf("FromCgroupV2() got = %v, want %v", limit, 0)
}
}
|