-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): fix some labels are lost when having same prefix key
This commit fix an issue where only a single system label was injected in the run context fix: kestra-io/kestra-ee#2697
- Loading branch information
1 parent
6bde5d5
commit 6f69dbb
Showing
3 changed files
with
54 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.kestra.core.models; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
class LabelTest { | ||
|
||
@Test | ||
void shouldGetNestedMapGivenDistinctLabels() { | ||
Map<String, Object> result = Label.toNestedMap(List.of( | ||
new Label(Label.USERNAME, "test"), | ||
new Label(Label.CORRELATION_ID, "id")) | ||
); | ||
|
||
Assertions.assertEquals( | ||
Map.of("system", Map.of("username", "test", "correlationId", "id")), | ||
result | ||
); | ||
} | ||
|
||
@Test | ||
void shouldGetNestedMapGivenDuplicateLabels() { | ||
Map<String, Object> result = Label.toNestedMap(List.of( | ||
new Label(Label.USERNAME, "test1"), | ||
new Label(Label.USERNAME, "test2"), | ||
new Label(Label.CORRELATION_ID, "id")) | ||
); | ||
|
||
Assertions.assertEquals( | ||
Map.of("system", Map.of("username", "test1", "correlationId", "id")), | ||
result | ||
); | ||
} | ||
} |