integration: promote db size metrics to "etcd"
@@ -40,8 +40,16 @@ func TestMetricDbSizeBoot(t *testing.T) {
}
}
-// TestMetricDbSizeDefrag checks that the db size metric is set after defrag.
func TestMetricDbSizeDefrag(t *testing.T) {
+ testMetricDbSizeDefrag(t, "etcd")
+}
+
+func TestMetricDbSizeDefragDebugging(t *testing.T) {
+ testMetricDbSizeDefrag(t, "etcd_debugging")
+}
+
+// testMetricDbSizeDefrag checks that the db size metric is set after defrag.
+func testMetricDbSizeDefrag(t *testing.T, name string) {
defer testutil.AfterTest(t)
clus := NewClusterV3(t, &ClusterConfig{Size: 1})
defer clus.Terminate(t)
@@ -63,7 +71,7 @@ func TestMetricDbSizeDefrag(t *testing.T) {
time.Sleep(500 * time.Millisecond)
expected := numPuts * len(putreq.Value)
- beforeDefrag, err := clus.Members[0].Metric("etcd_debugging_mvcc_db_total_size_in_bytes")
+ beforeDefrag, err := clus.Members[0].Metric(name + "_mvcc_db_total_size_in_bytes")
if err != nil {
t.Fatal(err)
}
@@ -74,7 +82,7 @@ func TestMetricDbSizeDefrag(t *testing.T) {
if bv < expected {
t.Fatalf("expected db size greater than %d, got %d", expected, bv)
}
- beforeDefragInUse, err := clus.Members[0].Metric("etcd_debugging_mvcc_db_total_size_in_use_in_bytes")
+ beforeDefragInUse, err := clus.Members[0].Metric("etcd_mvcc_db_total_size_in_use_in_bytes")
if err != nil {
t.Fatal(err)
}
@@ -98,7 +106,7 @@ func TestMetricDbSizeDefrag(t *testing.T) {
}
time.Sleep(500 * time.Millisecond)
- afterCompactionInUse, err := clus.Members[0].Metric("etcd_debugging_mvcc_db_total_size_in_use_in_bytes")
+ afterCompactionInUse, err := clus.Members[0].Metric("etcd_mvcc_db_total_size_in_use_in_bytes")
if err != nil {
t.Fatal(err)
}
@@ -113,7 +121,7 @@ func TestMetricDbSizeDefrag(t *testing.T) {
// defrag should give freed space back to fs
mc.Defragment(context.TODO(), &pb.DefragmentRequest{})
- afterDefrag, err := clus.Members[0].Metric("etcd_debugging_mvcc_db_total_size_in_bytes")
+ afterDefrag, err := clus.Members[0].Metric(name + "_mvcc_db_total_size_in_bytes")
if err != nil {
t.Fatal(err)
}
@@ -125,7 +133,7 @@ func TestMetricDbSizeDefrag(t *testing.T) {
t.Fatalf("expected less than %d, got %d after defrag", bv, av)
}
- afterDefragInUse, err := clus.Members[0].Metric("etcd_debugging_mvcc_db_total_size_in_use_in_bytes")
+ afterDefragInUse, err := clus.Members[0].Metric("etcd_mvcc_db_total_size_in_use_in_bytes")
if err != nil {
t.Fatal(err)
}
