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: query_result_forwarder_test.go
    path of file: ./repos/pixie/src/vizier/services/query_broker/controllers
    
    the code of the file until where you have to start completion: /*
 * Copyright 2018- The Pixie 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,
 * 
    
func TestStreamResultsResultsBeforeInitialization(t *testing.T) {
	queryID := uuid.Must(uuid.NewV4())

	f := controllers.NewQueryResultForwarderWithOptions(controllers.WithResultSinkTimeout(1 * time.Second))

	var wg sync.WaitGroup
	wg.Add(1)
	expectedTables := make(map[string]string)
	expectedTables["foo"] = "123"

	var results []*vizierpb.ExecuteScriptResponse
	resultCh := make(chan *vizierpb.ExecuteScriptResponse)

	consumerCtx, cancelConsumer := context.WithCancel(context.Background())
	defer cancelConsumer()
	producerCtx, cancelProducer := context.WithCancel(context.Background())
	defer cancelProducer()

	go func() {
		for {
			select {
			case msg := <-resultCh:
				results = append(results, msg)
			case <-consumerCtx.Done():
				wg.Done()
				return
			}
		}
	}()
	var err error

	assert.Nil(t, f.RegisterQuery(queryID, expectedTables, 350, nil, ""))

	go func() {
		err = f.StreamResults(consumerCtx, queryID, resultCh)
		cancelConsumer()
	}()

	_, in0 := makeRowBatchResult(t, queryID, "foo", "123" /*eos*/, true)
	_, in1 := makeExecStatsResult(t, queryID)
	assert.Nil(t, f.ForwardQueryResult(producerCtx, in0))
	assert.Nil(t, f.ForwardQueryResult(producerCtx, in1))
	wg.Wait()

	assert.Nil(t, err)
	assert.Equal(t, 2, len(results))
}