mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 19:05:42 +03:00
Add metrics command / output to debug bundle
This commit is contained in:
@@ -32,6 +32,29 @@ func TestDebugUtils(t *testing.T) {
|
||||
require.Equal(t, "https://127.0.0.1:8500", e.addr("foo"))
|
||||
}
|
||||
|
||||
func TestDebugSuccesses(t *testing.T) {
|
||||
t.Parallel()
|
||||
srv, _, _ := testServer(t, false, nil)
|
||||
defer srv.Shutdown()
|
||||
|
||||
ui := new(cli.MockUi)
|
||||
cmd := &OperatorDebugCommand{Meta: Meta{Ui: ui}}
|
||||
|
||||
// NOTE -- duration must be shorter than default 2m to prevent testify from timing out
|
||||
|
||||
// Debug on the leader
|
||||
code := cmd.Run([]string{"-duration", "250ms", "-server-id", "leader"})
|
||||
require.Equal(t, 0, code)
|
||||
require.Contains(t, ui.OutputWriter.String(), "Starting debugger")
|
||||
ui.OutputWriter.Reset()
|
||||
|
||||
// Debug on all servers
|
||||
code = cmd.Run([]string{"-duration", "250ms", "-server-id", "all"})
|
||||
require.Equal(t, 0, code)
|
||||
require.Contains(t, ui.OutputWriter.String(), "Starting debugger")
|
||||
ui.OutputWriter.Reset()
|
||||
}
|
||||
|
||||
func TestDebugFails(t *testing.T) {
|
||||
t.Parallel()
|
||||
srv, _, _ := testServer(t, false, nil)
|
||||
@@ -111,8 +134,10 @@ func TestDebugCapturedFiles(t *testing.T) {
|
||||
// Multiple snapshots are collected, 00 is always created
|
||||
require.FileExists(t, filepath.Join(path, "nomad", "0000", "jobs.json"))
|
||||
require.FileExists(t, filepath.Join(path, "nomad", "0000", "nodes.json"))
|
||||
require.FileExists(t, filepath.Join(path, "nomad", "0000", "metrics.json"))
|
||||
|
||||
// Multiple snapshots are collected, 01 requires two intervals
|
||||
require.FileExists(t, filepath.Join(path, "nomad", "0001", "jobs.json"))
|
||||
require.FileExists(t, filepath.Join(path, "nomad", "0001", "nodes.json"))
|
||||
require.FileExists(t, filepath.Join(path, "nomad", "0001", "metrics.json"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user