-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4512 from cyclinder/0.8_cp/coordinator_detect_tim…
…eout1 coodirnator: optimize the detectiong timeout for ip conflict and gateway detection
- Loading branch information
Showing
15 changed files
with
479 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2024 Authors of spidernet-io | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package ippoolmanager | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("IPPoolManagerConfig", Label("ippool_manager_test"), func() { | ||
var config IPPoolManagerConfig | ||
|
||
Describe("setDefaultsForIPPoolManagerConfig", func() { | ||
Context("when MaxAllocatedIPs is nil", func() { | ||
BeforeEach(func() { | ||
config = IPPoolManagerConfig{ | ||
MaxAllocatedIPs: nil, | ||
EnableKubevirtStaticIP: false, | ||
} | ||
}) | ||
|
||
It("should set MaxAllocatedIPs to default value", func() { | ||
result := setDefaultsForIPPoolManagerConfig(config) | ||
Expect(result.MaxAllocatedIPs).NotTo(BeNil()) | ||
Expect(*result.MaxAllocatedIPs).To(Equal(defaultMaxAllocatedIPs)) | ||
}) | ||
}) | ||
|
||
Context("when MaxAllocatedIPs is set", func() { | ||
BeforeEach(func() { | ||
maxIPs := 3000 | ||
config = IPPoolManagerConfig{ | ||
MaxAllocatedIPs: &maxIPs, | ||
EnableKubevirtStaticIP: true, | ||
} | ||
}) | ||
|
||
It("should retain the provided MaxAllocatedIPs value", func() { | ||
result := setDefaultsForIPPoolManagerConfig(config) | ||
Expect(result.MaxAllocatedIPs).NotTo(BeNil()) | ||
Expect(*result.MaxAllocatedIPs).To(Equal(3000)) | ||
}) | ||
}) | ||
|
||
Context("when EnableKubevirtStaticIP is true", func() { | ||
BeforeEach(func() { | ||
config = IPPoolManagerConfig{ | ||
MaxAllocatedIPs: nil, | ||
EnableKubevirtStaticIP: true, | ||
} | ||
}) | ||
|
||
It("should set MaxAllocatedIPs to default value", func() { | ||
result := setDefaultsForIPPoolManagerConfig(config) | ||
Expect(result.MaxAllocatedIPs).NotTo(BeNil()) | ||
Expect(*result.MaxAllocatedIPs).To(Equal(defaultMaxAllocatedIPs)) | ||
Expect(result.EnableKubevirtStaticIP).To(BeTrue()) | ||
}) | ||
}) | ||
|
||
Context("when EnableKubevirtStaticIP is false", func() { | ||
BeforeEach(func() { | ||
config = IPPoolManagerConfig{ | ||
MaxAllocatedIPs: nil, | ||
EnableKubevirtStaticIP: false, | ||
} | ||
}) | ||
|
||
It("should set MaxAllocatedIPs to default value", func() { | ||
result := setDefaultsForIPPoolManagerConfig(config) | ||
Expect(result.MaxAllocatedIPs).NotTo(BeNil()) | ||
Expect(*result.MaxAllocatedIPs).To(Equal(defaultMaxAllocatedIPs)) | ||
Expect(result.EnableKubevirtStaticIP).To(BeFalse()) | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.