This is an automated email from the ASF dual-hosted git repository.
gyeongtae pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new 3a0e42131b [ZEPPELIN-6316] Fix broken tests caused by field name change
3a0e42131b is described below
commit 3a0e42131b24d6e216031d2213349ef35a3303ae
Author: ChanHo Lee <[email protected]>
AuthorDate: Fri Sep 5 07:49:37 2025 +0900
[ZEPPELIN-6316] Fix broken tests caused by field name change
### What is this PR for?
After a field name change in `NewNoteRequest`, several tests are failing.
```
Error: Failures:
Error: NotebookRestApiTest.testCreateNote:555->lambda$testCreateNote$17:557
expected: <test1> but was: <Untitled Note>
Error: ZeppelinRestApiTest.testCloneNote:440->lambda$testCloneNote$8:443
Compare note names ==> expected: <clone Note Name> but was: <Cloned
Note_2M6SWJ8WV>
Error:
ZeppelinRestApiTest.testNoteCreateWithName:159->testNoteCreate:235->lambda$testNoteCreate$2:245
compare note name ==> expected: <Test note name> but was: <Untitled Note>
Error: ZeppelinRestApiTest.testNoteCreateWithParagraphs:181 test note
create method:
```
Related Issue: #5055
### What type of PR is it?
Fixing broken tests
### What is the Jira issue?
[ZEPPELIN-6316](https://issues.apache.org/jira/browse/ZEPPELIN-6316)
### How should this be tested?
- Check if tests success in `core-modules` job.
- `NotebookRestApiTest.testCreateNote`
- `ZeppelinRestApiTest.testCloneNote`
- `ZeppelinRestApiTest.testNoteCreateWithName`
- `ZeppelinRestApiTest.testNoteCreateWithParagraphs`
### Questions:
* Does the license files need to update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Closes #5066 from tbonelee/fix-tests.
Signed-off-by: ParkGyeongTae <[email protected]>
---
.../src/main/java/org/apache/zeppelin/client/ZeppelinClient.java | 2 +-
.../src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java | 6 ++++--
.../src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java | 6 +++---
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git
a/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZeppelinClient.java
b/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZeppelinClient.java
index bec349e0bc..a21ef99174 100644
---
a/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZeppelinClient.java
+++
b/zeppelin-client/src/main/java/org/apache/zeppelin/client/ZeppelinClient.java
@@ -303,7 +303,7 @@ public class ZeppelinClient {
*/
public String createNote(String notePath, String defaultInterpreterGroup)
throws Exception {
JSONObject bodyObject = new JSONObject();
- bodyObject.put("name", notePath);
+ bodyObject.put("notePath", notePath);
bodyObject.put("defaultInterpreterGroup", defaultInterpreterGroup);
HttpResponse<JsonNode> response = Unirest
.post("/notebook")
diff --git
a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
index 5cf4adbf5b..c93cc610d5 100644
---
a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
+++
b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
@@ -543,7 +543,7 @@ class NotebookRestApiTest extends AbstractTestRestApi {
@Test
void testCreateNote() throws Exception {
LOGGER.info("Running testCreateNote");
- String message1 = "{\n\t\"name\" : \"test1\",\n\t\"addingEmptyParagraph\"
: true\n}";
+ String message1 = "{\n\t\"notePath\" :
\"test1\",\n\t\"addingEmptyParagraph\" : true\n}";
CloseableHttpResponse post1 = httpPost("/notebook/", message1);
assertThat(post1, isAllowed());
@@ -555,6 +555,7 @@ class NotebookRestApiTest extends AbstractTestRestApi {
notebook.processNote(note1Id,
note1 -> {
assertEquals("test1", note1.getName());
+ assertEquals("/test1", note1.getPath());
assertEquals(1, note1.getParagraphCount());
assertNull(note1.getParagraph(0).getText());
assertNull(note1.getParagraph(0).getTitle());
@@ -562,7 +563,7 @@ class NotebookRestApiTest extends AbstractTestRestApi {
});
- String message2 = "{\n\t\"name\" : \"test2\"\n}";
+ String message2 = "{\n\t\"notePath\" : \"test2\"\n}";
CloseableHttpResponse post2 = httpPost("/notebook/", message2);
assertThat(post2, isAllowed());
@@ -576,6 +577,7 @@ class NotebookRestApiTest extends AbstractTestRestApi {
return note;
});
assertEquals("test2", note2.getName());
+ assertEquals("/test2", note2.getPath());
assertEquals(0, note2.getParagraphCount());
}
diff --git
a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java
b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java
index 28b5c77a76..5b3977c2ed 100644
---
a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java
+++
b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java
@@ -168,7 +168,7 @@ class ZeppelinRestApiTest extends AbstractTestRestApi {
void testNoteCreateWithParagraphs() throws IOException {
// Call Create Note REST API
String noteName = "test";
- String jsonRequest = "{\"name\":\"" + noteName + "\", \"paragraphs\": [" +
+ String jsonRequest = "{\"notePath\":\"" + noteName + "\", \"paragraphs\":
[" +
"{\"title\": \"title1\", \"text\": \"text1\"}," +
"{\"title\": \"title2\", \"text\": \"text2\"}," +
"{\"title\": \"titleConfig\", \"text\": \"text3\", " +
@@ -221,7 +221,7 @@ class ZeppelinRestApiTest extends AbstractTestRestApi {
private void testNoteCreate(String noteName) throws IOException {
// Call Create Note REST API
- String jsonRequest = "{\"name\":\"" + noteName + "\"}";
+ String jsonRequest = "{\"notePath\":\"" + noteName + "\"}";
CloseableHttpResponse post = httpPost("/notebook/", jsonRequest);
String postResponse = EntityUtils.toString(post.getEntity(),
StandardCharsets.UTF_8);
LOGGER.info("testNoteCreate \n" + postResponse);
@@ -426,7 +426,7 @@ class ZeppelinRestApiTest extends AbstractTestRestApi {
String noteName = "clone Note Name";
// Call Clone Note REST API
- String jsonRequest = "{\"name\":\"" + noteName + "\"}";
+ String jsonRequest = "{\"notePath\":\"" + noteName + "\"}";
CloseableHttpResponse post = httpPost("/notebook/" + noteId,
jsonRequest);
String postResponse = EntityUtils.toString(post.getEntity(),
StandardCharsets.UTF_8);
LOGGER.info("testNoteClone \n" + postResponse);