aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/internal/admin/jvm/mem_options_test.go
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2023-02-03 15:20:23 +0100
committerMartin Polden <mpolden@mpolden.no>2023-02-03 15:35:25 +0100
commite1e94812425a487069bf33f781bec987e9e49874 (patch)
tree4a892c3b5c0a7dee2cb76f9971e538cb4aba8a16 /client/go/internal/admin/jvm/mem_options_test.go
parenta08ae588d6035b69f0961dff596fc871fd1c4e58 (diff)
Re-organize Go code
Diffstat (limited to 'client/go/internal/admin/jvm/mem_options_test.go')
-rw-r--r--client/go/internal/admin/jvm/mem_options_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/client/go/internal/admin/jvm/mem_options_test.go b/client/go/internal/admin/jvm/mem_options_test.go
new file mode 100644
index 00000000000..c15143d4758
--- /dev/null
+++ b/client/go/internal/admin/jvm/mem_options_test.go
@@ -0,0 +1,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))
+}