mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
Merge pull request #10140 from hashicorp/b-gh-10070
agent: return req error if prometheus metrics are disabled.
This commit is contained in:
@@ -42,6 +42,7 @@ type TestServerConfig struct {
|
||||
Client *ClientConfig `json:"client,omitempty"`
|
||||
Vault *VaultConfig `json:"vault,omitempty"`
|
||||
ACL *ACLConfig `json:"acl,omitempty"`
|
||||
Telemetry *Telemetry `json:"telemetry,omitempty"`
|
||||
DevMode bool `json:"-"`
|
||||
Stdout, Stderr io.Writer `json:"-"`
|
||||
}
|
||||
@@ -90,6 +91,11 @@ type ACLConfig struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// Telemetry is used to configure the Nomad telemetry setup.
|
||||
type Telemetry struct {
|
||||
PrometheusMetrics bool `json:"prometheus_metrics"`
|
||||
}
|
||||
|
||||
// ServerConfigCallback is a function interface which can be
|
||||
// passed to NewTestServerConfig to modify the server config.
|
||||
type ServerConfigCallback func(c *TestServerConfig)
|
||||
|
||||
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/nomad/api/internal/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -31,7 +32,9 @@ func TestOperator_MetricsSummary(t *testing.T) {
|
||||
|
||||
func TestOperator_Metrics_Prometheus(t *testing.T) {
|
||||
t.Parallel()
|
||||
c, s := makeClient(t, nil, nil)
|
||||
c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) {
|
||||
c.Telemetry = &testutil.Telemetry{PrometheusMetrics: true}
|
||||
})
|
||||
defer s.Stop()
|
||||
|
||||
operator := c.Operator()
|
||||
|
||||
Reference in New Issue
Block a user