summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/infra/suite_cpu_pinning.go
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-07-17 14:38:48 +0200
committerDave Wallace <dwallacelf@gmail.com>2024-07-17 16:10:29 +0000
commitb69ee00c34ede374dad78f33106b39cf75087d5a (patch)
treed7f741ee85c4e9cddf973a03c3bbdf33c302fb5f /extras/hs-test/infra/suite_cpu_pinning.go
parentaedfd7ca3d2f5b17cfd20d4dc3919fe765adb27a (diff)
hs-test: minor cpu pinning suite improvements
- added max cpu check for CI - added a check for Ip4AddrAllocator: fixes a case where teardown panics if a test crashes before allocator gets initialized Type: test Change-Id: Ica12366cd79d77801964dfbdc8ee7c9969b4a9ce Signed-off-by: Adrian Villin <avillin@cisco.com>
Diffstat (limited to 'extras/hs-test/infra/suite_cpu_pinning.go')
-rw-r--r--extras/hs-test/infra/suite_cpu_pinning.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/extras/hs-test/infra/suite_cpu_pinning.go b/extras/hs-test/infra/suite_cpu_pinning.go
index 629d2dac3ed..e829efa950b 100644
--- a/extras/hs-test/infra/suite_cpu_pinning.go
+++ b/extras/hs-test/infra/suite_cpu_pinning.go
@@ -13,6 +13,7 @@ var cpuPinningSoloTests = map[string][]func(s *CpuPinningSuite){}
type CpuPinningSuite struct {
HstSuite
+ previousMaxContainerCount int
}
func RegisterCpuPinningTests(tests ...func(s *CpuPinningSuite)) {
@@ -31,12 +32,22 @@ func (s *CpuPinningSuite) SetupSuite() {
func (s *CpuPinningSuite) SetupTest() {
// Skip if we cannot allocate 3 CPUs for test container
- s.SkipIfNotEnoughAvailableCpus(1, 3)
- s.CpuPerVpp = 3
+ s.previousMaxContainerCount = s.CpuAllocator.maxContainerCount
+ s.CpuCount = 3
+ s.CpuAllocator.maxContainerCount = 1
+ s.SkipIfNotEnoughAvailableCpus()
+
s.HstSuite.SetupTest()
container := s.GetContainerByName(SingleTopoContainerVpp)
vpp, err := container.newVppInstance(container.AllocatedCpus)
s.AssertNotNil(vpp, fmt.Sprint(err))
+}
+
+func (s *CpuPinningSuite) TearDownTest() {
+ // reset vars
+ s.CpuCount = *NConfiguredCpus
+ s.CpuAllocator.maxContainerCount = s.previousMaxContainerCount
+ s.HstSuite.TearDownTest()
}