Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for allocateNext (0.16 sec)

  1. pkg/registry/core/service/ipallocator/cidrallocator_test.go

    	for r.Free() > 0 {
    		ip, err := r.AllocateNext()
    		if err != nil {
    			t.Fatalf("error @ free: %d count: %d: %v", r.Free(), count, err)
    		}
    		count++
    		if found.Has(ip.String()) {
    			t.Fatalf("allocated %s twice: %d", ip, count)
    		}
    		found.Insert(ip.String())
    	}
    	if count != 14 {
    		t.Fatalf("expected 14 IPs got %d", count)
    	}
    	if _, err := r.AllocateNext(); err == nil {
    		t.Fatal(err)
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Oct 31 21:05:06 UTC 2023
    - 13.7K bytes
    - Viewed (0)
  2. pkg/registry/core/service/ipallocator/bitmap_test.go

    		errors:    2,
    	}
    	expectMetrics(t, cidrIPv4, em)
    
    	// allocate 264 addresses for each allocator
    	// the full range and 10 more (254 + 10 = 264) for IPv4
    	for i := 0; i < 264; i++ {
    		a.AllocateNext()
    		b.AllocateNext()
    	}
    	em = testMetrics{
    		free:      0,
    		used:      254,
    		allocated: 256, // this is a counter, we already had 2 allocations and we did 254 more
    		errors:    12,
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 25 20:32:40 UTC 2023
    - 21.1K bytes
    - Viewed (0)
  3. pkg/registry/core/service/ipallocator/storage/storage_test.go

    		}
    	}
    	if _, err := storage.AllocateNext(); err == nil {
    		t.Error("Allocator expected to be full")
    	}
    	// release one address in the allocated block and another a new one randomly
    	if err := storage.Release(netutils.ParseIPSloppy("192.168.1.10")); err != nil {
    		t.Fatalf("Unexpected error trying to release ip 192.168.1.10: %v", err)
    	}
    	if _, err := storage.AllocateNext(); err != nil {
    		t.Error(err)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Aug 24 09:23:05 UTC 2023
    - 5.9K bytes
    - Viewed (0)
  4. pkg/registry/core/service/portallocator/operation_test.go

    	if err != nil {
    		t.Fatal(err)
    	}
    	for _, port := range previouslyAllocated {
    		_ = r.Allocate(port)
    	}
    	freeAtStart := r.Free()
    
    	// AllocateNext without a previously unused dry run operation
    	op := StartOperation(r, true)
    	port, err := op.AllocateNext()
    	if port == 0 {
    		t.Errorf("expected non zero port but got: %v", port)
    	}
    	if err != nil {
    		t.Errorf("expected no error but got: %v", err)
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Aug 15 23:44:12 UTC 2021
    - 3.1K bytes
    - Viewed (0)
  5. pkg/controller/nodeipam/ipam/cidrset/cidr_set_test.go

    			}
    			if a == nil {
    				return
    			}
    			p, err := a.AllocateNext()
    			if err == nil && tc.expectErr {
    				t.Errorf("a.AllocateNext() = nil, want error")
    			}
    			if err != nil && !tc.expectErr {
    				t.Errorf("a.AllocateNext() = %+v, want no error", err)
    			}
    			if !tc.expectErr {
    				if p != nil && p.String() != tc.expectedCIDR {
    					t.Fatalf("a.AllocateNext() got %+v, want %+v", p.String(), tc.expectedCIDR)
    				}
    			}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 11 08:53:03 UTC 2023
    - 29.5K bytes
    - Viewed (0)
  6. pkg/registry/core/service/portallocator/allocator_test.go

    	count := 0
    	for r.Free() > 0 {
    		p, err := r.AllocateNext()
    		if err != nil {
    			t.Fatalf("error @ %d: %v", count, err)
    		}
    		count++
    		if !pr.Contains(p) {
    			t.Fatalf("allocated %d which is outside of %v", p, pr)
    		}
    		if found.Has(strconv.Itoa(p)) {
    			t.Fatalf("allocated %d twice @ %d", p, count)
    		}
    		found.Insert(strconv.Itoa(p))
    	}
    	if _, err := r.AllocateNext(); err != ErrFull {
    		t.Fatal(err)
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 08 07:15:02 UTC 2024
    - 14K bytes
    - Viewed (0)
  7. pkg/registry/core/service/portallocator/storage/storage_test.go

    		}
    	}
    	if _, err := storage.AllocateNext(); err == nil {
    		t.Error("Allocator expected to be full")
    	}
    	// release one port in the allocated block and another a new one randomly
    	if err := storage.Release(basePortRange + 53); err != nil {
    		t.Fatalf("Unexpected error trying to release port 30053: %v", err)
    	}
    	if _, err := storage.AllocateNext(); err != nil {
    		t.Error(err)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 08 07:15:02 UTC 2024
    - 8.1K bytes
    - Viewed (0)
  8. pkg/registry/core/service/ipallocator/ipallocator_test.go

    		errors:    2,
    	}
    	expectMetrics(t, cidrIPv4, em)
    
    	// allocate 264 addresses for each allocator
    	// the full range and 10 more (254 + 10 = 264) for IPv4
    	for i := 0; i < 264; i++ {
    		a.AllocateNext()
    		b.AllocateNext()
    	}
    	em = testMetrics{
    		free:      0,
    		used:      254,
    		allocated: 256, // this is a counter, we already had 2 allocations and we did 254 more
    		errors:    12,
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Jun 25 13:14:46 UTC 2023
    - 24.2K bytes
    - Viewed (0)
  9. pkg/controller/nodeipam/ipam/controller_test.go

    		}
    		// Allocate until full.
    		var cidrs []*net.IPNet
    		for {
    			cidr, err := set.AllocateNext()
    			if err != nil {
    				if err == cidrset.ErrCIDRRangeNoCIDRsRemaining {
    					break
    				}
    				t.Errorf("set.AllocateNext() = %v, want %v", err, cidrset.ErrCIDRRangeNoCIDRsRemaining)
    				continue TestCase
    			}
    			cidrs = append(cidrs, cidr)
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jan 04 20:48:08 UTC 2018
    - 1.9K bytes
    - Viewed (0)
  10. pkg/registry/core/service/allocator/bitmap_test.go

    		t.Run(tc.name, func(t *testing.T) {
    			m := tc.allocator(tc.max, "test", tc.reserved)
    			for i := 0; i < tc.max; i++ {
    				if _, ok, _ := m.AllocateNext(); !ok {
    					t.Fatalf("unexpected error")
    				}
    			}
    			if _, ok, _ := m.AllocateNext(); ok {
    				t.Errorf("unexpected success")
    			}
    			if f := m.Free(); f != 0 {
    				t.Errorf("expect to get %d, but got %d", 0, f)
    			}
    		})
    	}
    }
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue May 10 08:56:31 UTC 2022
    - 13.3K bytes
    - Viewed (0)
Back to top