Ma77Ball commented on code in PR #6017:
URL: https://github.com/apache/texera/pull/6017#discussion_r3633773956
##########
amber/src/test/scala/org/apache/texera/web/resource/dashboard/file/WorkflowResourceSpec.scala:
##########
@@ -369,6 +372,57 @@ class WorkflowResourceSpec
assert(DashboardWorkflowEntryList.results.length == 2)
}
+ it should "return only single instance of workflow when owned and shared
publicly" in {
+ // Create a public workflow
+ val publicWorkflow = new Workflow()
+ publicWorkflow.setName("public_workflow_1")
+ publicWorkflow.setDescription(testWorkflow1.getDescription)
+ publicWorkflow.setContent(testWorkflow1.getContent)
+ publicWorkflow.setIsPublic(true)
+
+ // Persist workflow with testUser as owner
+ workflowResource.persistWorkflow(testWorkflow1, sessionUser1)
Review Comment:
This test builds `publicWorkflow` but persists `testWorkflow1`, which is
never public, and the test passes even without the fix. Persist the public
workflow instead.
```suggestion
workflowResource.persistWorkflow(publicWorkflow, sessionUser1)
```
##########
amber/src/test/scala/org/apache/texera/web/resource/dashboard/file/WorkflowResourceSpec.scala:
##########
@@ -369,6 +372,57 @@ class WorkflowResourceSpec
assert(DashboardWorkflowEntryList.results.length == 2)
}
+ it should "return only single instance of workflow when owned and shared
publicly" in {
+ // Create a public workflow
+ val publicWorkflow = new Workflow()
+ publicWorkflow.setName("public_workflow_1")
+ publicWorkflow.setDescription(testWorkflow1.getDescription)
+ publicWorkflow.setContent(testWorkflow1.getContent)
+ publicWorkflow.setIsPublic(true)
+
+ // Persist workflow with testUser as owner
+ workflowResource.persistWorkflow(testWorkflow1, sessionUser1)
+
+ val DashboardWorkflowEntryList =
+ dashboardResource.searchAllResourcesCall(
+ sessionUser1,
+ SearchQueryParams(),
+ includePublic = true
+ )
+ assert(DashboardWorkflowEntryList.results.length == 1)
+ assertSameWorkflow(testWorkflow1,
DashboardWorkflowEntryList.results.head.workflow.get)
Review Comment:
Assert on the public workflow so the dedup path is actually verified.
```suggestion
assertSameWorkflow(publicWorkflow,
DashboardWorkflowEntryList.results.head.workflow.get)
```
--
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]