Copilot commented on code in PR #11978:
URL: https://github.com/apache/gravitino/pull/11978#discussion_r3568483178


##########
core/src/test/java/org/apache/gravitino/job/TestBuiltInJobTemplateEventListener.java:
##########
@@ -446,6 +447,44 @@ public void 
testReconcileBuiltInJobTemplatesNoUpdateWhenVersionSame() throws IOE
     Assertions.assertEquals("v1", 
result.templateContent().customFields().get("version"));
   }
 
+  @Test
+  public void 
testReconcileBuiltInJobTemplatesUpdateWhenExecutableChangedButVersionSame()
+      throws IOException {
+    String metalakeName = "test_metalake";
+    Map<String, JobTemplate> builtInTemplates = new HashMap<>();
+
+    // Same version as the persisted entity, but a different executable path, 
e.g. because the
+    // Gravitino release version (and thus the jar filename) changed while the 
job logic did not.
+    ShellJobTemplate template =
+        ShellJobTemplate.builder()
+            .withName("builtin-existing")
+            .withComment("test")
+            
.withExecutable("/opt/gravitino/auxlib/gravitino-jobs-2.0.0-SNAPSHOT.jar")
+            .withCustomFields(Collections.singletonMap("version", "v1"))
+            .build();
+    builtInTemplates.put("builtin-existing", template);
+
+    // Existing entity was persisted with the old jar path.
+    JobTemplateEntity existingEntity = 
createJobTemplateEntity("builtin-existing", "v1");
+    entityStore.put(existingEntity, false);
+

Review Comment:
   The “executable changed but version same” regression test can pass even if 
reconciliation doesn’t actually compare/refresh the executable, because the 
persisted entity created by createJobTemplateEntity(...) has 
JobTemplateEntity.comment unset (null) and an executable of "/bin/echo". With 
the new contentChanged check, the update can be triggered by the comment 
mismatch (null vs "test"), so this test isn’t isolating the intended scenario 
(only executable drift). Build the existing entity with the same fields as the 
new template except for the executable (old jar path), and set the entity 
comment so equals() differs only on executable.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to