cloud/b/b/reflection: add single-line HumanValue rendering, Index
This is in preparation for printing fields in bmcli.
Change-Id: I1aa178da1a50e8dd0c572a238f92daa536f9fcd9
Reviewed-on: https://review.monogon.dev/c/monogon/+/2170
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/cloud/bmaas/bmdb/reflection_test.go b/cloud/bmaas/bmdb/reflection_test.go
index 6b8b506..38118cb 100644
--- a/cloud/bmaas/bmdb/reflection_test.go
+++ b/cloud/bmaas/bmdb/reflection_test.go
@@ -285,5 +285,13 @@
if !strings.Contains(v, "manufacturer:") {
t.Errorf("Invalid serialized prototext: %s", v)
}
+ fv, err := machine.Tags["HardwareReport"].Field("hardware_report_raw").Index("report.cpu[0].cores")
+ if err != nil {
+ t.Errorf("Could not get report.cpu[0].cores from hardware_report_raw: %v", err)
+ } else {
+ if want, got := "1", fv; want != got {
+ t.Errorf("report.cpu[0].cores should be %q, got %q", want, got)
+ }
+ }
}
}