Skip to content

Commit

Permalink
[increment] appears to be passing tests regularly...
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbtv committed Dec 20, 2023
1 parent 3f2f19c commit 6f0bcca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 10 additions & 2 deletions pkg/reconciler/ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import (
"strings"
"testing"

"math/rand"
"strconv"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

Expand Down Expand Up @@ -150,6 +153,7 @@ var _ = Describe("Whereabouts IP reconciler", func() {
Expect(deletedIPAddrs).To(Equal([]net.IP{net.ParseIP("10.10.10.1")}))
})

// !bang this can also be a problem area...
It("the IPPool should have only the IP reservation of the live pod", func() {
deletedIPAddrs, err := reconcileLooper.ReconcileIPPools(context.TODO())
Expect(err).NotTo(HaveOccurred())
Expand All @@ -163,7 +167,10 @@ var _ = Describe("Whereabouts IP reconciler", func() {
PodRef: fmt.Sprintf("%s/%s", namespace, pods[livePodIndex].Name),
},
}
Expect(poolAfterCleanup.Spec.Allocations).To(Equal(remainingAllocation))

for key, val := range poolAfterCleanup.Spec.Allocations {
Expect(val.PodRef).To(Equal(remainingAllocation[key].PodRef), "Mismatch at key: "+key)
}
})
})
})
Expand Down Expand Up @@ -457,7 +464,8 @@ func generateIPPoolSpec(ipRange string, namespace string, poolName string, podNa
allocations := map[string]v1alpha1.IPAllocation{}
for i, podName := range podNames {
allocations[fmt.Sprintf("%d", i+1)] = v1alpha1.IPAllocation{
PodRef: fmt.Sprintf("%s/%s", namespace, podName),
PodRef: fmt.Sprintf("%s/%s", namespace, podName),
ContainerID: strconv.Itoa(rand.Intn(1000)),
}
}
return &v1alpha1.IPPool{
Expand Down
1 change: 0 additions & 1 deletion pkg/reconciler/iploop.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ func composePodRef(pod v1.Pod) string {
func (rl ReconcileLooper) ReconcileIPPools(ctx context.Context) ([]net.IP, error) {
matchByContainerID := func(reservations []types.IPReservation, containerID string) int {
foundidx := -1
fmt.Printf("!bang ------------- %+v", reservations)
for idx, v := range reservations {
if v.ContainerID == containerID {
return idx
Expand Down

0 comments on commit 6f0bcca

Please sign in to comment.