-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…1823) * Clear transient header from system context * Clear transient header from system context * Adds changelog * Update CHANGELOG.md * Adds unit tests * Refactor code * Refactor code * Refactor code * Supress warning * Refactor code --------- (cherry picked from commit 71f1fab) Signed-off-by: Gagan Juneja <[email protected]> Signed-off-by: Gagan Juneja <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Gagan Juneja <[email protected]> Co-authored-by: Andriy Redko <[email protected]>
- Loading branch information
1 parent
c76df2d
commit 77d8964
Showing
9 changed files
with
193 additions
and
28 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
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
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
34 changes: 34 additions & 0 deletions
34
server/src/test/java/org/opensearch/tasks/TaskThreadContextStatePropagatorTests.java
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,34 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.tasks; | ||
|
||
import org.opensearch.test.OpenSearchTestCase; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.opensearch.tasks.TaskResourceTrackingService.TASK_ID; | ||
|
||
public class TaskThreadContextStatePropagatorTests extends OpenSearchTestCase { | ||
private final TaskThreadContextStatePropagator taskThreadContextStatePropagator = new TaskThreadContextStatePropagator(); | ||
|
||
public void testTransient() { | ||
Map<String, Object> transientHeader = new HashMap<>(); | ||
transientHeader.put(TASK_ID, "t_1"); | ||
Map<String, Object> transientPropagatedHeader = taskThreadContextStatePropagator.transients(transientHeader, false); | ||
assertEquals("t_1", transientPropagatedHeader.get(TASK_ID)); | ||
} | ||
|
||
public void testTransientForSystemContext() { | ||
Map<String, Object> transientHeader = new HashMap<>(); | ||
transientHeader.put(TASK_ID, "t_1"); | ||
Map<String, Object> transientPropagatedHeader = taskThreadContextStatePropagator.transients(transientHeader, true); | ||
assertEquals("t_1", transientPropagatedHeader.get(TASK_ID)); | ||
} | ||
} |
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