Skip to content

Commit

Permalink
address the comment
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Apr 23, 2023
1 parent bac3518 commit 39a08cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/gctuner/tuner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package gctuner

import (
"runtime"
"testing"
"time"

"github.com/docker/go-units"
"github.com/stretchr/testify/require"
)

var testHeap []byte

func TestTuner(t *testing.T) {
EnableGOGCTuner.Store(true)
memLimit := uint64(1000 * 1024 * 1024) // 1000 MB
memLimit := uint64(1000 * units.MiB) // 1000 MB
threshold := memLimit / 2
tn := newTuner(threshold)
require.Equal(t, threshold, tn.threshold.Load())
Expand Down Expand Up @@ -80,7 +82,7 @@ func TestTuner(t *testing.T) {
}

func TestCalcGCPercent(t *testing.T) {
const gb = 1024 * 1024 * 1024
const gb = units.GiB
// use default value when invalid params
require.Equal(t, defaultGCPercent, calcGCPercent(0, 0))
require.Equal(t, defaultGCPercent, calcGCPercent(0, 1))
Expand Down

0 comments on commit 39a08cd

Please sign in to comment.