Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for MustGarbageCollect (0.36 sec)

  1. tests/util/leak/check.go

    		if err := check(nil); err != nil {
    			log.Errorf("fatal: %v", err)
    			exitCode = 1
    		}
    	}
    
    	os.Exit(exitCode)
    }
    
    // MustGarbageCollect asserts that an object was garbage collected by the end of the test.
    // The input must be a pointer to an object.
    func MustGarbageCollect(tb test.Failer, i any) {
    	tb.Helper()
    	collected := atomic.NewBool(false)
    	runtime.SetFinalizer(i, func(x any) {
    		collected.Store(true)
    	})
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Dec 20 10:22:38 UTC 2023
    - 6.9K bytes
    - Viewed (0)
  2. pkg/slices/slices_test.go

    		Junk string
    	}
    	var input []*s
    	var output []*s
    	t.Run("inner", func(t *testing.T) {
    		a := &s{"a"}
    		b := &s{"b"}
    		// Check that we can garbage collect elements when we delete them.
    		leak.MustGarbageCollect(t, b)
    		input = []*s{a, b}
    		output = Delete(input, 1)
    	})
    	assert.Equal(t, output, []*s{{"a"}})
    	assert.Equal(t, input, []*s{{"a"}, nil})
    }
    
    func TestContains(t *testing.T) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 10 23:33:56 UTC 2024
    - 18.2K bytes
    - Viewed (0)
  3. pilot/pkg/model/typed_xds_cache_test.go

    	// Since shallow copy shares the underlying array, we can use it to check.
    	cache := c.(*lruCache[uint64])
    	evictQueue := cache.evictQueue
    	for _, item := range evictQueue {
    		leak.MustGarbageCollect(t, &item)
    	}
    
    	if f == "Flush" {
    		cache.Flush()
    	} else {
    		cache.ClearAll()
    	}
    
    	// Checks that the elements referenced by the underlying array have been released.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jan 29 20:35:31 UTC 2024
    - 18.2K bytes
    - Viewed (0)
  4. pilot/pkg/xds/ads_test.go

    func TestPushQueueLeak(t *testing.T) {
    	ds := xdsfake.NewFakeDiscoveryServer(t, xdsfake.FakeOptions{})
    	p := ds.ConnectADS()
    	p.RequestResponseAck(t, nil)
    	for _, c := range ds.Discovery.AllClients() {
    		leak.MustGarbageCollect(t, c)
    	}
    	ds.Discovery.AdsPushAll(&model.PushRequest{Push: ds.PushContext()})
    	p.Cleanup()
    }
    
    func TestDistribution(t *testing.T) {
    	xds.ResetConnectionNumberForTest()
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Jan 30 17:25:17 UTC 2024
    - 30.3K bytes
    - Viewed (0)
Back to top