github.com/matrixorigin/matrixone@v1.2.0/pkg/util/metric/v2/dashboard/grafana_dashboard_test.go (about)

     1  // Copyright 2023 Matrix Origin
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package dashboard
    16  
    17  import (
    18  	"testing"
    19  
    20  	"github.com/stretchr/testify/require"
    21  )
    22  
    23  // TestCreateCloudDashboard creates a dashboard for cloud env.
    24  func TestCreateCloudDashboard(t *testing.T) {
    25  	if testing.Short() {
    26  		t.Skip("skipping in short mode.")
    27  		return
    28  	}
    29  
    30  	c := NewCloudDashboardCreator("http://127.0.0.1", "admin", "admin", "Prometheus")
    31  	require.NoError(t, c.Create())
    32  }
    33  
    34  // TestCreateLocalDashboard creates a dashboard for local env.
    35  func TestCreateLocalDashboard(t *testing.T) {
    36  	if testing.Short() {
    37  		t.Skip("skipping in short mode.")
    38  		return
    39  	}
    40  
    41  	c := NewLocalDashboardCreator("http://127.0.0.1", "admin", "admin", "Prometheus")
    42  	require.NoError(t, c.Create())
    43  }
    44  
    45  // TestCreateK8SDashboard creates a dashboard for k8s env(EKS, TKE).
    46  func TestCreateK8SDashboard(t *testing.T) {
    47  	if testing.Short() {
    48  		t.Skip("skipping in short mode.")
    49  		return
    50  	}
    51  
    52  	c := NewK8SDashboardCreator("http://127.0.0.1", "admin", "admin", "Prometheus")
    53  	require.NoError(t, c.Create())
    54  }
    55  
    56  // TestCreateCloudCtrlPlaneDashboard creates a dashboard for cloud env. (used in control-plane)
    57  // diff TestCreateCloudDashboard, which is used in data-plane (unit).
    58  func TestCreateCloudCtrlPlaneDashboard(t *testing.T) {
    59  	if testing.Short() {
    60  		t.Skip("skipping in short mode.")
    61  		return
    62  	}
    63  
    64  	c := NewCloudCtrlPlaneDashboardCreator("http://127.0.0.1", "admin", "admin", "Prometheus")
    65  	require.NoError(t, c.Create())
    66  }