From 734c4d1ae15efb6ee6511f9a9d61fec6b85dc668 Mon Sep 17 00:00:00 2001 From: Ievgeniia Zadorozhna Date: Wed, 8 May 2024 15:19:59 +0200 Subject: [PATCH] Fixed the flaky test in the ProtectedPathSpec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements #5390 Related to #5608 Fixes #5653 * Fixed the test "Flow swaps to protected path when main path gets broken, becomes DEGRADED if protected path is unable to reroute(no bw)" * Earlier the otherIsls list was not correct since it contained some ISLs from the protected path. Now the otherIsls (not involved into mair or protected paths) list is correct and the “Couldn’t find non overlapping protected path” message is correct. * Removed the workaround to skip 8-9 from 2 tests --- .../spec/flows/ProtectedPathSpec.groovy | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src-java/testing/functional-tests/src/test/groovy/org/openkilda/functionaltests/spec/flows/ProtectedPathSpec.groovy b/src-java/testing/functional-tests/src/test/groovy/org/openkilda/functionaltests/spec/flows/ProtectedPathSpec.groovy index 61bc84ea1dd..3e94e670de4 100644 --- a/src-java/testing/functional-tests/src/test/groovy/org/openkilda/functionaltests/spec/flows/ProtectedPathSpec.groovy +++ b/src-java/testing/functional-tests/src/test/groovy/org/openkilda/functionaltests/spec/flows/ProtectedPathSpec.groovy @@ -373,13 +373,7 @@ class ProtectedPathSpec extends HealthCheckSpecification { @Tags([ISL_RECOVER_ON_FAIL, ISL_PROPS_DB_RESET]) def "Flow swaps to protected path when main path gets broken, becomes DEGRADED if protected path is unable to reroute(no bw)"() { given: "Two switches with 2 diverse paths at least" - //def switchPair = switchPairs.all().withAtLeastNNonOverlappingPaths(2).random() - //https://github.com/telstra/open-kilda/issues/5608 - def switchesWhere5608IsReproducible = topology.activeSwitches.findAll {it.dpId.toString().endsWith("08") - ||it.dpId.toString().endsWith("09")} - def switchPair = switchPairs.all() - .excludeSwitches(switchesWhere5608IsReproducible) - .withAtLeastNNonOverlappingPaths(2).random() + def switchPair = switchPairs.all().withAtLeastNNonOverlappingPaths(2).random() when: "Create flow with protected path" def flow = flowHelperV2.randomFlow(switchPair).tap { allocateProtectedPath = true } @@ -387,8 +381,13 @@ class ProtectedPathSpec extends HealthCheckSpecification { def path = northbound.getFlowPath(flow.flowId) and: "Other paths have not enough bandwidth to host the flow in case of reroute" - def otherIsls = switchPair.paths.findAll { it != pathHelper.convert(path.protectedPath) && - it != pathHelper.convert(path) }.collectMany { pathHelper.getInvolvedIsls(it) } + def originalMainPath = pathHelper.convert(path) + def originalProtectedPath = pathHelper.convert(path.protectedPath) + def usedIsls = pathHelper.getInvolvedIsls(originalMainPath) + + pathHelper.getInvolvedIsls(originalProtectedPath) + def otherIsls = switchPair.paths.findAll { it != originalMainPath && + it != originalProtectedPath }.collectMany { pathHelper.getInvolvedIsls(it) } + .findAll { !usedIsls.contains(it) && !usedIsls.contains(it.reversed) } .unique { a, b -> a == b || a == b.reversed ? 0 : 1 } otherIsls.collectMany{[it, it.reversed]}.each { database.updateIslMaxBandwidth(it, flow.maximumBandwidth - 1) @@ -407,9 +406,7 @@ class ProtectedPathSpec extends HealthCheckSpecification { status == FlowState.DEGRADED.toString() flowStatusDetails.mainFlowPathStatus == "Up" flowStatusDetails.protectedFlowPathStatus == "Down" - statusInfo =~ ~/Not enough bandwidth or no path found. Switch \ -(${switchPair.getSrc().getDpId()}|${switchPair.getDst().getDpId()}) doesn't have links with enough bandwidth, \ -Failed to find path with requested bandwidth=$flow.maximumBandwidth/ + statusInfo == StatusInfo.OVERLAPPING_PROTECTED_PATH } } @@ -431,14 +428,7 @@ Failed to find path with requested bandwidth=$flow.maximumBandwidth/ @Tags(ISL_RECOVER_ON_FAIL) def "Flow swaps to protected path when main path gets broken, becomes DEGRADED if protected path is unable to reroute(no path)"() { given: "Two switches with 2 diverse paths at least" - //def switchPair = switchPairs.all().withAtLeastNNonOverlappingPaths(2).random() - //https://github.com/telstra/open-kilda/issues/5608 - def switchesWhere5608IsReproducible = topology.activeSwitches.findAll {it.dpId.toString().endsWith("08") - ||it.dpId.toString().endsWith("09")} - def switchPair = switchPairs.all() - .excludeSwitches(switchesWhere5608IsReproducible) - .withAtLeastNNonOverlappingPaths(2).random() - + def switchPair = switchPairs.all().withAtLeastNNonOverlappingPaths(2).random() when: "Create flow with protected path" def flow = flowHelperV2.randomFlow(switchPair).tap { allocateProtectedPath = true }