Skip to content

Commit

Permalink
asdasd
Browse files Browse the repository at this point in the history
  • Loading branch information
xagent003 committed Jan 20, 2022
1 parent 6dc1468 commit 5f03ce5
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions pkg/reconciler/iploop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ var _ = Describe("IPReconciler", func() {

BeforeEach(func() {
podRef := "default/pod1"
reservations := generateIPReservation(firstIPInRange, podRef)
containerID := "1234567890"
reservations := generateIPReservation(firstIPInRange, podRef, containerID)

pool := generateIPPool(ipCIDR, podRef)
orphanedIPAddr := OrphanedIPReservations{
Expand All @@ -86,7 +87,8 @@ var _ = Describe("IPReconciler", func() {
Context("and they are actually multiple IPs", func() {
BeforeEach(func() {
podRef := "default/pod2"
reservations := generateIPReservation("192.168.14.2", podRef)
containerID := "1234567890"
reservations := generateIPReservation("192.168.14.2", podRef, containerID)

pool := generateIPPool(ipCIDR, podRef, "default/pod2", "default/pod3")
orphanedIPAddr := OrphanedIPReservations{
Expand All @@ -107,10 +109,12 @@ var _ = Describe("IPReconciler", func() {
Context("but the IP reservation owner does not match", func() {
var reservationPodRef string
BeforeEach(func() {
reservationPodRef = "default/pod2"
reservationPodRef = "default/pod1"
reservationContainerID = "1234567890"
podRef := "default/pod1"
reservations := generateIPReservation(firstIPInRange, podRef)
erroredReservations := generateIPReservation(firstIPInRange, reservationPodRef)
podContainerID := "0987654321"
reservations := generateIPReservation(firstIPInRange, podRef, podContainerID)
erroredReservations := generateIPReservation(firstIPInRange, reservationPodRef, reservationContainerID)

pool := generateIPPool(ipCIDR, podRef)
orphanedIPAddr := OrphanedIPReservations{
Expand Down Expand Up @@ -144,11 +148,12 @@ func generateIPPool(cidr string, podRefs ...string) whereaboutsv1alpha1.IPPool {
}
}

func generateIPReservation(ip string, podRef string) []types.IPReservation {
func generateIPReservation(ip string, podRef, containerID string) []types.IPReservation {
return []types.IPReservation{
{
IP: net.ParseIP(ip),
PodRef: podRef,
IP: net.ParseIP(ip),
PodRef: podRef,
ContainerID: containerID,
},
}
}
Expand Down

0 comments on commit 5f03ce5

Please sign in to comment.