Skip to content

Commit

Permalink
Add dependencies for load-balance redundant-load-balance tests, add l…
Browse files Browse the repository at this point in the history
…oad-balance test
  • Loading branch information
arr2036 committed Jun 10, 2014
1 parent 46de64a commit a75da04
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
97 changes: 97 additions & 0 deletions src/tests/keywords/load-balance
@@ -0,0 +1,97 @@
# PRE: update if foreach
#
# Load-Balance blocks.
#
# Should distribute load between the modules.
#
update request {
Tmp-Integer-0 := 0
Tmp-Integer-1 := 0

Tmp-Integer-2 += 0 # 0
Tmp-Integer-2 += 1
Tmp-Integer-2 += 2
Tmp-Integer-2 += 3
Tmp-Integer-2 += 4
Tmp-Integer-2 += 5
Tmp-Integer-2 += 6
Tmp-Integer-2 += 7
Tmp-Integer-2 += 8
Tmp-Integer-2 += 9 # 10
Tmp-Integer-2 += 0
Tmp-Integer-2 += 1
Tmp-Integer-2 += 2
Tmp-Integer-2 += 3
Tmp-Integer-2 += 4
Tmp-Integer-2 += 5
Tmp-Integer-2 += 6
Tmp-Integer-2 += 7
Tmp-Integer-2 += 8
Tmp-Integer-2 += 9 # 20
Tmp-Integer-2 += 0
Tmp-Integer-2 += 1
Tmp-Integer-2 += 2
Tmp-Integer-2 += 3
Tmp-Integer-2 += 4
Tmp-Integer-2 += 5
Tmp-Integer-2 += 6
Tmp-Integer-2 += 7
Tmp-Integer-2 += 8
Tmp-Integer-2 += 9 # 30
Tmp-Integer-2 += 0
Tmp-Integer-2 += 1
Tmp-Integer-2 += 2
Tmp-Integer-2 += 3
Tmp-Integer-2 += 4
Tmp-Integer-2 += 5
Tmp-Integer-2 += 6
Tmp-Integer-2 += 7
Tmp-Integer-2 += 8
Tmp-Integer-2 += 9 # 40
Tmp-Integer-2 += 0
Tmp-Integer-2 += 1
Tmp-Integer-2 += 2
Tmp-Integer-2 += 3
Tmp-Integer-2 += 4
Tmp-Integer-2 += 5
Tmp-Integer-2 += 6
Tmp-Integer-2 += 7
Tmp-Integer-2 += 8
Tmp-Integer-2 += 9 # 49
}

#
# Loop 0..9
#
foreach &Tmp-Integer-2 {
load-balance {
group {
update request {
Tmp-Integer-0 := "%{expr:%{Tmp-Integer-0} + 1}"
Filter-Id += "PICKED GROUP 1 %{Tmp-Integer-0} TIME(S)"
}
ok
}
group {
update request {
Tmp-Integer-1 := "%{expr:%{Tmp-Integer-1} + 1}"
Filter-Id += "PICKED GROUP 2 %{Tmp-Integer-1} TIME(S)"
}
ok
}
}
}

# The chances of one group being used over another 50 times by random occurrence
# is quite small, and if this happens repeatedly, it's likely there's a bug in
# the load-balance code or random number generator.
if ((&Tmp-Integer-0 == 0) || (&Tmp-Integer-1 == 0)) {
update reply {
Filter-Id += "fail 1 %{Tmp-Integer-0}/%{Tmp-Integer-1})"
}
}
else {
update reply {
Filter-Id := 'filter'
}
}
1 change: 1 addition & 0 deletions src/tests/keywords/redundant
@@ -1,3 +1,4 @@
# PRE: update if foreach
#
# Redundant blocks.
#
Expand Down
1 change: 1 addition & 0 deletions src/tests/keywords/redundant-load-balance
@@ -1,3 +1,4 @@
# PRE: update if foreach
#
# Redundant blocks.
#
Expand Down

0 comments on commit a75da04

Please sign in to comment.