diff --git a/src/policy/src/main/java/eu/teraflow/policy/Serializer.java b/src/policy/src/main/java/eu/teraflow/policy/Serializer.java index 52d594ea4200c2ce4d775edf2f06cf7a9c9f9097..5ca1098444d6ec6f926ca3a844553606c97f0278 100644 --- a/src/policy/src/main/java/eu/teraflow/policy/Serializer.java +++ b/src/policy/src/main/java/eu/teraflow/policy/Serializer.java @@ -1557,8 +1557,21 @@ public class Serializer { final var kpiValueMin = kpiValueRange.getKpiMinValue(); final var kpiValueMax = kpiValueRange.getKpiMaxValue(); - final var serializedKpiValueMin = serialize(kpiValueMin); - final var serializedKpiValueMax = serialize(kpiValueMax); + Monitoring.KpiValue serializedKpiValueMin; + Monitoring.KpiValue serializedKpiValueMax; + + if (kpiValueMin == null && kpiValueMax == null) { + throw new IllegalStateException("KPI value max and min cannot be both null"); + } else if (kpiValueMax == null) { + serializedKpiValueMin = serialize(kpiValueMin); + serializedKpiValueMax = serialize(new StringKpiValue("NaN")); + } else if (kpiValueMin == null) { + serializedKpiValueMin = serialize(new StringKpiValue("NaN")); + serializedKpiValueMax = serialize(kpiValueMax); + } else { + serializedKpiValueMin = serialize(kpiValueMin); + serializedKpiValueMax = serialize(kpiValueMax); + } builder.setKpiMinValue(serializedKpiValueMin); builder.setKpiMaxValue(serializedKpiValueMax); diff --git a/src/tests/benchmark/policy/deploy_specs.sh b/src/tests/benchmark/policy/deploy_specs.sh old mode 100755 new mode 100644