[Config Validator] Add string_buffer_max to Report Definition
Add the definition of string_buffer_max to report definitions.
These changes are for the Config Validator to recognize the
string_buffer_max is defined under the report definition.
Bug: 79464
Change-Id: I3a8409fdb23f69fe6bdae0f9562797f7dab6dd1f
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/670282
Reviewed-by: Cameron Dale <camrdale@google.com>
Commit-Queue: Andrew Hwang <anhwang@google.com>
diff --git a/src/bin/config_parser/src/config_validator/report_definitions.go b/src/bin/config_parser/src/config_validator/report_definitions.go
index 581b766..5d6fa56 100644
--- a/src/bin/config_parser/src/config_validator/report_definitions.go
+++ b/src/bin/config_parser/src/config_validator/report_definitions.go
@@ -458,6 +458,9 @@
if r.IntBuckets != nil {
return fmt.Errorf("int_buckets can not be specified for report of type %s.", r.ReportType)
}
+ if r.StringBufferMax == 0 {
+ return fmt.Errorf("no string_buffer_max specified for report of type %s.", r.ReportType)
+ }
return nil
}
@@ -466,6 +469,9 @@
if r.IntBuckets != nil {
return fmt.Errorf("int_buckets can not be specified for report of type %s.", r.ReportType)
}
+ if r.StringBufferMax == 0 {
+ return fmt.Errorf("no string_buffer_max specified for report of type %s.", r.ReportType)
+ }
return nil
}
diff --git a/src/bin/config_parser/src/config_validator/report_definitions_test.go b/src/bin/config_parser/src/config_validator/report_definitions_test.go
index 8ee5382..420e3a1 100644
--- a/src/bin/config_parser/src/config_validator/report_definitions_test.go
+++ b/src/bin/config_parser/src/config_validator/report_definitions_test.go
@@ -473,6 +473,7 @@
r := makeValidReport()
r.ReportType = config.ReportDefinition_STRING_COUNTS
r.PrivacyLevel = config.ReportDefinition_NO_ADDED_PRIVACY
+ r.StringBufferMax = 10
if err := validateReportDefinition(m, r); err != nil {
t.Errorf("Failed validation for valid report of type STRING_COUNTS: %v", err)
@@ -491,6 +492,7 @@
r.ReportType = config.ReportDefinition_UNIQUE_DEVICE_STRING_COUNTS
r.PrivacyLevel = config.ReportDefinition_NO_ADDED_PRIVACY
r.LocalAggregationPeriod = config.WindowSize_WINDOW_1_DAY
+ r.StringBufferMax = 10
if err := validateReportDefinition(m, r); err != nil {
t.Errorf("Failed validation for valid report of type UNIQUE_DEVICE_STRING_COUNTS: %v", err)
diff --git a/src/logger/test_registries/cobalt1.1_migration_registry.yaml b/src/logger/test_registries/cobalt1.1_migration_registry.yaml
index d3c3bbd..19612ae 100644
--- a/src/logger/test_registries/cobalt1.1_migration_registry.yaml
+++ b/src/logger/test_registries/cobalt1.1_migration_registry.yaml
@@ -101,6 +101,7 @@
id: 103
report_type: STRING_COUNTS
privacy_level: NO_ADDED_PRIVACY
+ string_buffer_max: 5
meta_data: *meta_data
- id: 4
diff --git a/src/logger/test_registries/cobalt1.1_test_registry.yaml b/src/logger/test_registries/cobalt1.1_test_registry.yaml
index c227dd5..adca8de 100644
--- a/src/logger/test_registries/cobalt1.1_test_registry.yaml
+++ b/src/logger/test_registries/cobalt1.1_test_registry.yaml
@@ -100,10 +100,12 @@
- report_name: "Component_Histogram"
id: 1
report_type: STRING_COUNTS
+ string_buffer_max: 30
system_profile_selection: SELECT_LAST
- report_name: "Component_Histogram_Two"
id: 2
report_type: STRING_COUNTS
+ string_buffer_max: 30
system_profile_selection: SELECT_LAST
meta_data:
expiration_date: "2021/01/01"