Skip to content

Commit fd31ac3

Browse files
author
kamaleshnneerasa
committed
unit test fix
1 parent 913331d commit fd31ac3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

label-application-rule-config-service-impl/src/main/java/org/hypertrace/label/application/rule/config/service/LabelApplicationRuleValidatorImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public void validateLabelExpression(Action.DynamicLabel dynamicLabel) {
185185
int startOffset = 0;
186186
while (startOffset < labelExpression.length() && matcher.find(startOffset)) {
187187
String match = matcher.group();
188-
String key = match.substring(1, match.length() - 1);
188+
String key = match.substring(2, match.length() - 1);
189189
startOffset = startOffset + matcher.end();
190190
if (!validKeys.contains(key)) {
191191
throwInvalidArgumentException("Invalid key name in label expression");

label-application-rule-config-service-impl/src/test/java/org/hypertrace/label/application/rule/config/service/LabelApplicationRuleValidatorTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ void validateLabelExpression() {
197197
Condition.newBuilder().setLeafCondition(errorLeafCondition).build();
198198
CreateLabelApplicationRuleRequest request1 =
199199
buildCreateCreateLabelApplicationRuleRequest(
200-
"Label Expression Rule", matchingCondition, Optional.of("${status}_{wrong-key}"));
200+
"Label Expression Rule", matchingCondition, Optional.of("${status}_${wrong-key}"));
201201
Throwable exception =
202202
assertThrows(
203203
StatusRuntimeException.class,
@@ -206,7 +206,7 @@ void validateLabelExpression() {
206206
});
207207
CreateLabelApplicationRuleRequest request2 =
208208
buildCreateCreateLabelApplicationRuleRequest(
209-
"Label Expression Rule", matchingCondition, Optional.of("${status}_{method}"));
209+
"Label Expression Rule", matchingCondition, Optional.of("${status}_${method}"));
210210
assertDoesNotThrow(
211211
() -> {
212212
labelApplicationRuleValidator.validateOrThrow(REQUEST_CONTEXT, request2);

0 commit comments

Comments
 (0)