Skip to content

Commit

Permalink
Fixed the flaky test in the ProtectedPathSpec
Browse files Browse the repository at this point in the history
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
  • Loading branch information
izadorozhna committed May 8, 2024
1 parent fc395cc commit 5a2a5d0
Showing 1 changed file with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,22 +373,21 @@ 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 }
flowHelperV2.addFlow(flow)
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)
Expand All @@ -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
}
}

Expand All @@ -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 }
Expand Down

0 comments on commit 5a2a5d0

Please sign in to comment.