...

Source file src/github.com/prometheus/procfs/sysfs/vmstat_numa_test.go

Documentation: github.com/prometheus/procfs/sysfs

     1  // Copyright 2020 The Prometheus Authors
     2  // Licensed under the Apache License, Version 2.0 (the "License");
     3  // you may not use this file except in compliance with the License.
     4  // You may obtain a copy of the License at
     5  //
     6  // http://www.apache.org/licenses/LICENSE-2.0
     7  //
     8  // Unless required by applicable law or agreed to in writing, software
     9  // distributed under the License is distributed on an "AS IS" BASIS,
    10  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  //go:build linux
    15  // +build linux
    16  
    17  package sysfs
    18  
    19  import (
    20  	"testing"
    21  )
    22  
    23  func TestParseVMStatNUMA(t *testing.T) {
    24  	fs, err := NewFS(sysTestFixtures)
    25  	if err != nil {
    26  		t.Fatal(err)
    27  	}
    28  
    29  	vmstat, err := fs.VMStatNUMA()
    30  	if err != nil {
    31  		t.Fatal(err)
    32  	}
    33  	if want, got := uint64(1), vmstat[1].NrFreePages; want != got {
    34  		t.Errorf("want vmstat stat nr_free_pages value %d, got %d", want, got)
    35  	}
    36  
    37  	if want, got := uint64(5), vmstat[1].NrZoneActiveFile; want != got {
    38  		t.Errorf("want numa stat nr_zone_active_file %d, got %d", want, got)
    39  	}
    40  	if want, got := uint64(7), vmstat[2].NrFreePages; want != got {
    41  		t.Errorf("want vmstat stat nr_free_pages value %d, got %d", want, got)
    42  	}
    43  
    44  	if want, got := uint64(11), vmstat[2].NrZoneActiveFile; want != got {
    45  		t.Errorf("want numa stat nr_zone_active_file %d, got %d", want, got)
    46  	}
    47  }
    48  

View as plain text