@@ -114,8 +114,8 @@ type TestScenarios struct {
114114 BuildID string
115115 PodImage string
116116 Scenarios []PodScenario
117- VnetSubnetCache map [string ]VnetSubnetInfo // Cache for vnet/subnet info
118- NodeUsageTracker map [string ]map [ string ] bool // Tracks which nodes are used per vnet/subnet: "vnet/subnet" -> map[nodeName]bool
117+ VnetSubnetCache map [string ]VnetSubnetInfo // Cache for vnet/subnet info
118+ UsedNodes map [string ]bool // Tracks which nodes are already used (one pod per node for low-NIC)
119119}
120120
121121// VnetSubnetInfo holds network information for a vnet/subnet combination
@@ -337,31 +337,27 @@ func CreateScenarioResources(scenario PodScenario, testScenarios TestScenarios)
337337
338338 // Step 5: Select appropriate node based on scenario
339339 var targetNode string
340- vnetSubnetKey := fmt .Sprintf ("%s/%s" , scenario .VnetName , scenario .SubnetName )
341340
342- // Initialize node usage tracker for this vnet/subnet if not exists
343- if testScenarios .NodeUsageTracker == nil {
344- testScenarios .NodeUsageTracker = make (map [string ]map [string ]bool )
345- }
346- if testScenarios .NodeUsageTracker [vnetSubnetKey ] == nil {
347- testScenarios .NodeUsageTracker [vnetSubnetKey ] = make (map [string ]bool )
341+ // Initialize used nodes tracker if not exists
342+ if testScenarios .UsedNodes == nil {
343+ testScenarios .UsedNodes = make (map [string ]bool )
348344 }
349345
350346 if scenario .NodeSelector == "low-nic" {
351347 if len (nodeInfo .LowNicNodes ) == 0 {
352348 return fmt .Errorf ("scenario %s: no low-NIC nodes available" , scenario .Name )
353349 }
354- // Find first unused node in the pool
350+ // Find first unused node in the pool (low-NIC nodes can only handle one pod)
355351 targetNode = ""
356352 for _ , node := range nodeInfo .LowNicNodes {
357- if ! testScenarios.NodeUsageTracker [ vnetSubnetKey ] [node ] {
353+ if ! testScenarios .UsedNodes [node ] {
358354 targetNode = node
359- testScenarios.NodeUsageTracker [ vnetSubnetKey ] [node ] = true
355+ testScenarios .UsedNodes [node ] = true
360356 break
361357 }
362358 }
363359 if targetNode == "" {
364- return fmt .Errorf ("scenario %s: all low-NIC nodes already used for %s " , scenario .Name , vnetSubnetKey )
360+ return fmt .Errorf ("scenario %s: all low-NIC nodes already in use " , scenario .Name )
365361 }
366362 } else { // "high-nic"
367363 if len (nodeInfo .HighNicNodes ) == 0 {
@@ -370,14 +366,14 @@ func CreateScenarioResources(scenario PodScenario, testScenarios TestScenarios)
370366 // Find first unused node in the pool
371367 targetNode = ""
372368 for _ , node := range nodeInfo .HighNicNodes {
373- if ! testScenarios.NodeUsageTracker [ vnetSubnetKey ] [node ] {
369+ if ! testScenarios .UsedNodes [node ] {
374370 targetNode = node
375- testScenarios.NodeUsageTracker [ vnetSubnetKey ] [node ] = true
371+ testScenarios .UsedNodes [node ] = true
376372 break
377373 }
378374 }
379375 if targetNode == "" {
380- return fmt .Errorf ("scenario %s: all high-NIC nodes already used for %s " , scenario .Name , vnetSubnetKey )
376+ return fmt .Errorf ("scenario %s: all high-NIC nodes already in use " , scenario .Name )
381377 }
382378 }
383379
0 commit comments