mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 13:55:55 +00:00
Add tests for new snapshot inspect flags
This commit is contained in:
parent
5f5b49955c
commit
be2a212d75
@ -95,3 +95,57 @@ func TestSnapshotInspectCommand(t *testing.T) {
|
||||
want := golden(t, t.Name(), ui.OutputWriter.String())
|
||||
require.Equal(t, want, ui.OutputWriter.String())
|
||||
}
|
||||
|
||||
func TestSnapshotInspectDetailedCommand(t *testing.T) {
|
||||
|
||||
filepath := "./testdata/backup-with-kv.snap"
|
||||
|
||||
// Inspect the snapshot
|
||||
ui := cli.NewMockUi()
|
||||
c := New(ui)
|
||||
args := []string{"-detailed", filepath}
|
||||
|
||||
code := c.Run(args)
|
||||
if code != 0 {
|
||||
t.Fatalf("bad: %d. %#v", code, ui.ErrorWriter.String())
|
||||
}
|
||||
|
||||
want := golden(t, t.Name(), ui.OutputWriter.String())
|
||||
require.Equal(t, want, ui.OutputWriter.String())
|
||||
}
|
||||
|
||||
func TestSnapshotInspectDetailedDepthCommand(t *testing.T) {
|
||||
|
||||
filepath := "./testdata/backup-with-kv.snap"
|
||||
|
||||
// Inspect the snapshot
|
||||
ui := cli.NewMockUi()
|
||||
c := New(ui)
|
||||
args := []string{"-detailed", "-depth", "3", filepath}
|
||||
|
||||
code := c.Run(args)
|
||||
if code != 0 {
|
||||
t.Fatalf("bad: %d. %#v", code, ui.ErrorWriter.String())
|
||||
}
|
||||
|
||||
want := golden(t, t.Name(), ui.OutputWriter.String())
|
||||
require.Equal(t, want, ui.OutputWriter.String())
|
||||
}
|
||||
|
||||
func TestSnapshotInspectDetailedDepthFilterCommand(t *testing.T) {
|
||||
|
||||
filepath := "./testdata/backup-with-kv.snap"
|
||||
|
||||
// Inspect the snapshot
|
||||
ui := cli.NewMockUi()
|
||||
c := New(ui)
|
||||
args := []string{"-detailed", "-depth", "3", "-filter", "vault/logical", filepath}
|
||||
|
||||
code := c.Run(args)
|
||||
if code != 0 {
|
||||
t.Fatalf("bad: %d. %#v", code, ui.ErrorWriter.String())
|
||||
}
|
||||
|
||||
want := golden(t, t.Name(), ui.OutputWriter.String())
|
||||
require.Equal(t, want, ui.OutputWriter.String())
|
||||
}
|
||||
|
27
command/snapshot/inspect/testdata/TestSnapshotInspectDetailedCommand.golden
vendored
Normal file
27
command/snapshot/inspect/testdata/TestSnapshotInspectDetailedCommand.golden
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
ID 2-12426-1604593650375
|
||||
Size 17228
|
||||
Index 12426
|
||||
Term 2
|
||||
Version 1
|
||||
|
||||
Type Count Size
|
||||
---- ---- ----
|
||||
KVS 27 12.3KB
|
||||
Register 5 3.4KB
|
||||
Index 11 285B
|
||||
Autopilot 1 199B
|
||||
Session 1 199B
|
||||
CoordinateBatchUpdate 1 166B
|
||||
Tombstone 2 146B
|
||||
FederationState 1 139B
|
||||
ChunkingState 1 12B
|
||||
---- ---- ----
|
||||
Total 16.8KB
|
||||
|
||||
Key Name Count Size
|
||||
---- ---- ----
|
||||
vault/core 16 5.9KB
|
||||
vault/sys 7 4.4KB
|
||||
vault/logical 4 2KB
|
||||
---- ---- ----
|
||||
Total 12.3KB
|
44
command/snapshot/inspect/testdata/TestSnapshotInspectDetailedDepthCommand.golden
vendored
Normal file
44
command/snapshot/inspect/testdata/TestSnapshotInspectDetailedDepthCommand.golden
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
ID 2-12426-1604593650375
|
||||
Size 17228
|
||||
Index 12426
|
||||
Term 2
|
||||
Version 1
|
||||
|
||||
Type Count Size
|
||||
---- ---- ----
|
||||
KVS 27 12.3KB
|
||||
Register 5 3.4KB
|
||||
Index 11 285B
|
||||
Session 1 199B
|
||||
Autopilot 1 199B
|
||||
CoordinateBatchUpdate 1 166B
|
||||
Tombstone 2 146B
|
||||
FederationState 1 139B
|
||||
ChunkingState 1 12B
|
||||
---- ---- ----
|
||||
Total 16.8KB
|
||||
|
||||
Key Name Count Size
|
||||
---- ---- ----
|
||||
vault/sys/policy 3 3.3KB
|
||||
vault/logical/0989e79e-06cd-5374-c8c0-4c6d675bc1c9 3 1.8KB
|
||||
vault/core/leader 1 1.6KB
|
||||
vault/sys/token 3 1KB
|
||||
vault/core/mounts 1 675B
|
||||
vault/core/wrapping 1 633B
|
||||
vault/core/local-mounts 1 450B
|
||||
vault/core/auth 1 423B
|
||||
vault/core/cluster 2 388B
|
||||
vault/core/keyring 1 320B
|
||||
vault/core/master 1 237B
|
||||
vault/core/seal-config 1 211B
|
||||
vault/logical/5c018b68-3573-41d3-0c33-04bce60cd6b0 1 210B
|
||||
vault/core/hsm 1 189B
|
||||
vault/core/local-audit 1 185B
|
||||
vault/core/local-auth 1 183B
|
||||
vault/core/audit 1 179B
|
||||
vault/core/lock 1 170B
|
||||
vault/core/shamir-kek 1 159B
|
||||
vault/sys/counters 1 155B
|
||||
---- ---- ----
|
||||
Total 12.3KB
|
26
command/snapshot/inspect/testdata/TestSnapshotInspectDetailedDepthFilterCommand.golden
vendored
Normal file
26
command/snapshot/inspect/testdata/TestSnapshotInspectDetailedDepthFilterCommand.golden
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
ID 2-12426-1604593650375
|
||||
Size 17228
|
||||
Index 12426
|
||||
Term 2
|
||||
Version 1
|
||||
|
||||
Type Count Size
|
||||
---- ---- ----
|
||||
KVS 27 12.3KB
|
||||
Register 5 3.4KB
|
||||
Index 11 285B
|
||||
Session 1 199B
|
||||
Autopilot 1 199B
|
||||
CoordinateBatchUpdate 1 166B
|
||||
Tombstone 2 146B
|
||||
FederationState 1 139B
|
||||
ChunkingState 1 12B
|
||||
---- ---- ----
|
||||
Total 16.8KB
|
||||
|
||||
Key Name Count Size
|
||||
---- ---- ----
|
||||
vault/logical/0989e79e-06cd-5374-c8c0-4c6d675bc1c9 3 1.8KB
|
||||
vault/logical/5c018b68-3573-41d3-0c33-04bce60cd6b0 1 210B
|
||||
---- ---- ----
|
||||
Total 2KB
|
BIN
command/snapshot/inspect/testdata/backup-with-kv.snap
vendored
Normal file
BIN
command/snapshot/inspect/testdata/backup-with-kv.snap
vendored
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user