Skip to content

Commit

Permalink
Merge pull request #250 from caseydavenport/fix-nil
Browse files Browse the repository at this point in the history
Add test
  • Loading branch information
caseydavenport authored Nov 6, 2016
2 parents 5d335f6 + 65ec0ec commit ac76589
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/client/ipam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,38 @@ type testArgsClaimAff struct {

var _ = Describe("IPAM tests", func() {

Describe("IPAM AutoAssign from any pool", func() {
testutils.CleanEtcd()
c, _ := testutils.NewClient("")
ic := setupIPAMClient(true)

testutils.CreateNewIPPool(*c, "10.0.0.0/24", false, false, true)
testutils.CreateNewIPPool(*c, "20.0.0.0/24", false, false, true)

// Assign an IP address, don't pass a pool, make sure we can get an
// address.
Context("AutoAssign 1 IP from any pool", func() {
args := client.AutoAssignArgs{
Num4: 1,
Num6: 0,
Hostname: "test-host",
}
// Call once in order to assign an IP address and create a block.
v4, _, outErr := ic.AutoAssign(args)
It("should have assigned an IP address with no error", func() {
Expect(outErr).NotTo(HaveOccurred())
Expect(len(v4) == 1).To(BeTrue())
})

// Call again to trigger an assignment from the newly created block.
v4, _, outErr = ic.AutoAssign(args)
It("should have assigned an IP address with no error", func() {
Expect(outErr).NotTo(HaveOccurred())
Expect(len(v4) == 1).To(BeTrue())
})
})
})

Describe("IPAM AutoAssign from different pools", func() {
testutils.CleanEtcd()
c, _ := testutils.NewClient("")
Expand Down

0 comments on commit ac76589

Please sign in to comment.