Skip to content

Commit

Permalink
Added UTs for ensuring monitor workflow metadata is deleted on deleti…
Browse files Browse the repository at this point in the history
…ng monitor workflow
  • Loading branch information
Nishtha Mehrotra committed Jan 15, 2025
1 parent ad8aa7a commit 69f8e1e
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5053,6 +5053,9 @@ class MonitorDataSourcesIT : AlertingSingleNodeTestCase() {
assertNotNull(getWorkflowResponse)
assertEquals(workflowId, getWorkflowResponse.id)

// Verify that monitor workflow metadata exists
assertNotNull(searchMonitorMetadata("${workflowResponse.id}-metadata-${monitorResponse.id}-metadata"))

deleteWorkflow(workflowId, false)
// Verify that the workflow is deleted
try {
Expand All @@ -5068,6 +5071,19 @@ class MonitorDataSourcesIT : AlertingSingleNodeTestCase() {
// Verify that the monitor is not deleted
val existingDelegate = getMonitorResponse(monitorResponse.id)
assertNotNull(existingDelegate)

// Verify that the monitor workflow metadata is deleted
try {
searchMonitorMetadata("${workflowResponse.id}-metadata-${monitorResponse.id}-metadata")
fail("expected searchMonitorMetadata method to throw exception")
} catch (e: Exception) {
e.message?.let {
assertTrue(
"Exception not returning GetMonitor Action error ",
it.contains("List is empty")
)
}
}
}

fun `test delete workflow delegate monitor deleted`() {
Expand All @@ -5093,6 +5109,9 @@ class MonitorDataSourcesIT : AlertingSingleNodeTestCase() {
assertNotNull(getWorkflowResponse)
assertEquals(workflowId, getWorkflowResponse.id)

// Verify that monitor workflow metadata exists
assertNotNull(searchMonitorMetadata("${workflowResponse.id}-metadata-${monitorResponse.id}-metadata"))

deleteWorkflow(workflowId, true)
// Verify that the workflow is deleted
try {
Expand All @@ -5116,6 +5135,18 @@ class MonitorDataSourcesIT : AlertingSingleNodeTestCase() {
)
}
}
// Verify that the monitor workflow metadata is deleted
try {
searchMonitorMetadata("${workflowResponse.id}-metadata-${monitorResponse.id}-metadata")
fail("expected searchMonitorMetadata method to throw exception")
} catch (e: Exception) {
e.message?.let {
assertTrue(
"Exception not returning GetMonitor Action error ",
it.contains("List is empty")
)
}
}
}

fun `test delete executed workflow with metadata deleted`() {
Expand Down

0 comments on commit 69f8e1e

Please sign in to comment.