Skip to content

Commit 023562d

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
integration tests: add env var SMBOP_TEST_MIN_NODE_COUNT
Add yet another environment variable to inform the test suite about the outer world. The variable SMBOP_TEST_MIN_NODE_COUNT should be set to the number of nodes that typical pods may be scheduled on, the tests may then use this value to determine if the cluster is in-spec or out-of-spec for tests that require a certain number of nodes. Signed-off-by: John Mulligan <[email protected]>
1 parent 86afebe commit 023562d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/integration/common_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package integration
55

66
import (
7+
"fmt"
78
"math/rand"
89
"os"
910
"strconv"
@@ -23,6 +24,8 @@ var (
2324
testClusteredShares = false
2425

2526
testShuffleOrder = false
27+
28+
testMinNodeCount = 0
2629
)
2730

2831
func init() {
@@ -65,6 +68,20 @@ func init() {
6568
testShuffleOrder = true
6669
}
6770

71+
// specify the number of nodes available for the test run. Some tests
72+
// require >1 node or >N nodes to function, so this can be used to decide
73+
// what to run in those cases. This should only specify the number of
74+
// "worker" nodes that can run samba pods - it should not include control
75+
// plane nodes that are not schedulable by default.
76+
nc := os.Getenv("SMBOP_TEST_MIN_NODE_COUNT")
77+
if nc != "" {
78+
if v, err := strconv.ParseInt(nc, 10, 32); err == nil {
79+
testMinNodeCount = int(v)
80+
} else {
81+
fmt.Printf("Failed to convert %s to an int\n", nc)
82+
}
83+
}
84+
6885
// ensure that tests run with a random seed. This can be removed once
6986
// we're certain we run only with Go 1.20+ OR we ought to make this
7087
// settable for test reproduction purposes.

0 commit comments

Comments
 (0)