Skip to content

Commit c600d9e

Browse files
committed
Rename param, add comments
Signed-off-by: Daniel Widdis <[email protected]>
1 parent c997281 commit c600d9e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

Diff for: src/main/java/org/opensearch/flowframework/indices/FlowFrameworkIndicesHandler.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,14 @@ public void updateTemplateInGlobalContext(String documentId, Template template,
403403
* @param documentId the document Id
404404
* @param template the use-case template
405405
* @param listener action listener
406-
* @param force if set true, ignores the requirement that the provisioning is not started
406+
* @param ignoreNotStartedCheck if set true, ignores the requirement that the provisioning is not started
407407
*/
408-
public void updateTemplateInGlobalContext(String documentId, Template template, ActionListener<IndexResponse> listener, boolean force) {
408+
public void updateTemplateInGlobalContext(
409+
String documentId,
410+
Template template,
411+
ActionListener<IndexResponse> listener,
412+
boolean ignoreNotStartedCheck
413+
) {
409414
if (!doesIndexExist(GLOBAL_CONTEXT_INDEX)) {
410415
String errorMessage = "Failed to update template for workflow_id : " + documentId + ", global_context index does not exist.";
411416
logger.error(errorMessage);
@@ -415,7 +420,7 @@ public void updateTemplateInGlobalContext(String documentId, Template template,
415420
doesTemplateExist(documentId, templateExists -> {
416421
if (templateExists) {
417422
isWorkflowNotStarted(documentId, workflowIsNotStarted -> {
418-
if (workflowIsNotStarted || force) {
423+
if (workflowIsNotStarted || ignoreNotStartedCheck) {
419424
IndexRequest request = new IndexRequest(GLOBAL_CONTEXT_INDEX).id(documentId);
420425
try (
421426
XContentBuilder builder = XContentFactory.jsonBuilder();

Diff for: src/test/java/org/opensearch/flowframework/bwc/FlowFrameworkBackwardsCompatibilityIT.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,29 +102,29 @@ public static ClusterType parse(String value) {
102102

103103
@SuppressWarnings("unchecked")
104104
public void testBackwardsCompatibility() throws Exception {
105+
// This iteration of nodes is only to get plugins installed on each node. We don't currently use its functionality but in case we
106+
// ever need version-based dependencies in future BWC tests it will be needed. It's directly copied from similar implementations
107+
// in other plugins.
105108
String uri = getUri();
106109
Map<String, Map<String, Object>> responseMap = (Map<String, Map<String, Object>>) getAsMap(uri).get("nodes");
107110
for (Map<String, Object> response : responseMap.values()) {
108111
List<Map<String, Object>> plugins = (List<Map<String, Object>>) response.get("plugins");
109112
Set<Object> pluginNames = plugins.stream().map(map -> map.get("name")).collect(Collectors.toSet());
113+
assertTrue(pluginNames.contains("opensearch-flow-framework"));
110114
String workflowId = createNoopTemplate();
111115
Template t = getTemplate(workflowId);
112116
switch (CLUSTER_TYPE) {
113117
case OLD:
114-
assertTrue(pluginNames.contains("opensearch-flow-framework"));
115118
// mapping for 2.12 does not include time stamps
116119
assertNull(t.createdTime());
117120
assertNull(t.lastUpdatedTime());
118121
assertNull(t.lastProvisionedTime());
119122
break;
120123
case MIXED:
121-
assertTrue(pluginNames.contains("opensearch-flow-framework"));
122124
// Time stamps may or may not be null depending on whether index has been accessed by new version node
123-
// So just test that the template parses
124125
assertNull(t.lastProvisionedTime());
125126
break;
126127
case UPGRADED:
127-
assertTrue(pluginNames.contains("opensearch-flow-framework"));
128128
// mapping for 2.13+ includes time stamps
129129
assertNotNull(t.createdTime());
130130
assertEquals(t.createdTime(), t.lastUpdatedTime());

0 commit comments

Comments
 (0)