From 0770f0080f095a2de46705e72ab9e03ce75d0344 Mon Sep 17 00:00:00 2001 From: q131172019 <47511691+q131172019@users.noreply.github.com> Date: Wed, 10 Aug 2022 16:54:07 -0700 Subject: [PATCH] [BugFix] #104 - simulator: panic: invalid argument to Intn (#126) * Fix bug #104 * Minor changes based on feedback --- .../test/resourceRegionMgrSimulator/main.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resource-management/test/resourceRegionMgrSimulator/main.go b/resource-management/test/resourceRegionMgrSimulator/main.go index b77f2295..1fbf7b42 100644 --- a/resource-management/test/resourceRegionMgrSimulator/main.go +++ b/resource-management/test/resourceRegionMgrSimulator/main.go @@ -46,6 +46,20 @@ func main() { flag.Parse() } + // Input parameter error handling for c.RpNum and c.NodesPerRP + // Fix bug #104 + klog.Info("") + if c.RpNum < 1 { + klog.Errorf("Error: Region resource manager simulator config / rp number per region: (%v) is less than 1", c.RpNum) + os.Exit(1) + } + + if c.NodesPerRP < 1 { + klog.Errorf("Error: Region resource manager simulator config / node number per rp: (%v) is less than 1", c.NodesPerRP) + os.Exit(1) + } + klog.Info("") + // Keep a more frequent flush frequency as 1 second klog.StartFlushDaemon(time.Second * 1)