Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for NewFakeClock (0.33 sec)

  1. pkg/kubelet/util/cache/object_cache_test.go

    		key: "foo",
    		val: "bar",
    	}
    	objectCache := NewFakeObjectCache(func() (interface{}, error) {
    		return nil, fmt.Errorf("Unexpected Error: updater should never be called in this test")
    	}, 1*time.Hour, testingclock.NewFakeClock(time.Now()))
    
    	err := objectCache.Add(testObj.key, testObj.val)
    	if err != nil {
    		t.Errorf("Unable to add obj %#v by key: %s", testObj, testObj.key)
    	}
    	value, err := objectCache.Get(testObj.key)
    	if err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Sep 17 13:19:08 UTC 2021
    - 2.6K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apiserver/pkg/server/healthz_test.go

    )
    
    func TestDelayedHealthCheck(t *testing.T) {
    	t.Run("test that liveness check returns true until the delay has elapsed", func(t *testing.T) {
    		t0 := time.Unix(0, 0)
    		c := testingclock.NewFakeClock(t0)
    		doneCh := make(chan struct{})
    
    		healthCheck := delayedHealthCheck(postStartHookHealthz{"test", doneCh}, c, time.Duration(10)*time.Second)
    		err := healthCheck.Check(nil)
    		if err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Sep 15 09:52:18 UTC 2021
    - 2.2K bytes
    - Viewed (0)
  3. pkg/controller/tainteviction/timed_workers_test.go

    		atomic.AddInt32(&testVal, 1)
    		wg.Done()
    		return nil
    	})
    	now := time.Now()
    	then := now.Add(10 * time.Second)
    	fakeClock := testingclock.NewFakeClock(now)
    	queue.clock = fakeClock
    	queue.AddWork(context.TODO(), NewWorkArgs("1", "1"), now, then)
    	queue.AddWork(context.TODO(), NewWorkArgs("2", "2"), now, then)
    	queue.AddWork(context.TODO(), NewWorkArgs("3", "3"), now, then)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 30 12:23:56 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  4. pilot/pkg/leaderelection/k8sleaderelection/healthzadaptor_test.go

    					LeaseDuration: time.Minute,
    					Name:          "foo",
    				},
    				observedRecord: rl.LeaderElectionRecord{
    					HolderIdentity: "healthTest",
    				},
    				observedTime: current,
    				clock:        clock.NewFakeClock(current.Add(time.Hour)),
    			},
    		},
    		{
    			description:    "call check when the lease is far expired but held by another server",
    			expected:       nil,
    			adaptorTimeout: time.Second * 20,
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Sep 12 18:41:53 UTC 2022
    - 5.3K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/cache_test.go

    	"time"
    
    	"k8s.io/apimachinery/pkg/util/sets"
    	"k8s.io/apiserver/pkg/storage/value"
    	testingclock "k8s.io/utils/clock/testing"
    )
    
    func TestSimpleCacheSetError(t *testing.T) {
    	fakeClock := testingclock.NewFakeClock(time.Now())
    	cache := newSimpleCache(fakeClock, time.Second, "providerName")
    
    	tests := []struct {
    		name        string
    		key         []byte
    		transformer value.Transformer
    	}{
    		{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Aug 31 20:26:58 UTC 2023
    - 4.9K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency_test.go

    		filterRecord = requestFilterRecordFrom(req.Context())
    	})
    
    	requestFilterStarted := time.Now()
    	wrapped := trackStarted(handler, noopoteltrace.NewTracerProvider(), filterName, testingclock.NewFakeClock(requestFilterStarted))
    
    	testRequest, err := http.NewRequest(http.MethodGet, "/api/v1/namespaces", nil)
    	if err != nil {
    		t.Fatalf("failed to create new http request - %v", err)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jun 07 17:57:37 UTC 2024
    - 7.1K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/dropped_requests_tracker_test.go

    */
    
    package flowcontrol
    
    import (
    	"fmt"
    	"sync"
    	"testing"
    	"time"
    
    	testingclock "k8s.io/utils/clock/testing"
    )
    
    func TestDroppedRequestsTracker(t *testing.T) {
    	fakeClock := testingclock.NewFakeClock(time.Now())
    	tracker := newDroppedRequestsTracker(fakeClock.Now)
    
    	// The following table represents the list over time of:
    	// - seconds elapsed (as computed since the initial time)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri May 26 13:50:25 UTC 2023
    - 4.9K bytes
    - Viewed (0)
  8. pkg/kubelet/active_deadline_test.go

    }
    
    func TestNewActiveDeadlineHandler(t *testing.T) {
    	pods := newTestPods(1)
    	podStatusProvider := &mockPodStatusProvider{pods: pods}
    	fakeRecorder := &record.FakeRecorder{}
    	fakeClock := testingclock.NewFakeClock(time.Now())
    
    	testCases := []struct {
    		podStatusProvider status.PodStatusProvider
    		recorder          record.EventRecorder
    		clock             clock.Clock
    	}{
    		{podStatusProvider, fakeRecorder, fakeClock},
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Oct 08 09:06:42 UTC 2022
    - 4.5K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/pkg/endpoints/filters/request_received_time_test.go

    		// does the handler chain that follows see the request received timestamp?
    		receivedTimestampGot, ok = request.ReceivedTimestampFrom(req.Context())
    	})
    
    	wrapped := withRequestReceivedTimestampWithClock(handler, testingclock.NewFakeClock(receivedTimestampExpected))
    
    	testRequest, err := http.NewRequest(http.MethodGet, "/api/v1/namespaces", nil)
    	if err != nil {
    		t.Fatalf("failed to create new http request - %v", err)
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Sep 15 09:52:18 UTC 2021
    - 2K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/integrator_test.go

    */
    
    package fairqueuing
    
    import (
    	"math"
    	"testing"
    	"time"
    
    	testclock "k8s.io/utils/clock/testing"
    )
    
    func TestIntegrator(t *testing.T) {
    	now := time.Now()
    	clk := testclock.NewFakeClock(now)
    	igr := NewNamedIntegrator(clk, "testee")
    	igr.Add(3)
    	clk.Step(time.Second)
    	results := igr.GetResults()
    	rToo := igr.Reset()
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Oct 27 21:11:44 UTC 2022
    - 1.6K bytes
    - Viewed (0)
Back to top