github.com/uvalib/orcid-access-ws@v0.0.0-20250612130209-7d062dbabf9d/orcidaccessws/tests/metrics_test.go (about)

     1  package test
     2  
     3  import (
     4  	"github.com/uvalib/orcid-access-ws/orcidaccessws/client"
     5  	"net/http"
     6  	"strings"
     7  	"testing"
     8  )
     9  
    10  //
    11  // metrics tests
    12  //
    13  
    14  func TestMetricsCheck(t *testing.T) {
    15  	expected := http.StatusOK
    16  	status, metrics := client.MetricsCheck(cfg.Endpoint)
    17  	if status != expected {
    18  		t.Fatalf("Expected %v, got %v\n", expected, status)
    19  	}
    20  
    21  	if len(metrics) == 0 {
    22  		t.Fatalf("Expected non-empty metrics info\n")
    23  	}
    24  
    25  	if strings.Contains(metrics, "go_goroutines") == false {
    26  		t.Fatalf("Expected go_goroutines value in metrics info\n")
    27  	}
    28  }
    29  
    30  //
    31  // end of file
    32  //