aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/internal/admin/jvm/mem_options_test.go
blob: c15143d4758418b121de3c432fbba54f5ecfb2b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package jvm

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestAdjustment(t *testing.T) {
	lastAdj := 64
	for i := 0; i < 4096; i++ {
		adj := adjustAvailableMemory(MegaBytesOfMemory(i)).ToMB()
		assert.True(t, int(adj) >= lastAdj)
		lastAdj = int(adj)
	}
	adj := adjustAvailableMemory(MegaBytesOfMemory(31024)).ToMB()
	assert.Equal(t, 30000, int(adj))
}