You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: counting_test.go
    path of file: ./repos/kubernetes/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing/promise
    
    the code of the file until where you have to start completion: /*
Copyright 2019 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package promise

import (
	"contex
    
func TestCountingWriteOnceInitial(t *testing.T) {
	oldTime := time.Now()
	cval := &oldTime
	clock, counter := testeventclock.NewFake(oldTime, 0, nil)
	ctx, cancel := context.WithCancel(context.Background())
	var lock sync.Mutex
	now := time.Now()
	aval := &now
	wr := NewCountingWriteOnce(counter, &lock, aval, ctx.Done(), cval)
	gots := make(chan interface{}, 1)
	goGetAndExpect(t, clock, counter, wr, gots, aval)
	goGetAndExpect(t, clock, counter, wr, gots, aval) // check that a set value stays set
	later := time.Now()
	bval := &later
	func() {
		lock.Lock()
		defer lock.Unlock()
		if wr.Set(bval) {
			t.Error("Set of initialized promise returned true")
		}
	}()
	goGetAndExpect(t, clock, counter, wr, gots, aval)
	counter.Add(1) // account for unblocking receive on doneCh
	cancel()
	time.Sleep(time.Second) // give it a chance to misbehave
	goGetAndExpect(t, clock, counter, wr, gots, aval)
}