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: script_runner_test.go
    path of file: ./repos/pixie/src/vizier/services/query_broker/script_runner
    
    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,
 * 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.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

package scriptrunner

import (
	"context"
	"errors"
	"io"
	"testing"
	"time"

	"github.com/gofrs/uuid"
	"github.com/gogo/protobuf/types"
	"github.com/golang/mock/gomock"
	"github.com/stretchr/testify/require"
	"google
    
func TestScriptRunner_ScriptUpdates(t *testing.T) {
	const scriptID = "223e4567-e89b-12d3-a456-426655440002"
	tests := []struct {
		name     string
		queryStr string
		updates  []*cvmsgspb.CronScriptUpdate
	}{
		{
			name:     "tracks new cron scripts",
			queryStr: "updated script",
			updates: []*cvmsgspb.CronScriptUpdate{
				{
					Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{
						UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{
							Script: &cvmsgspb.CronScript{
								ID:         utils.ProtoFromUUIDStrOrNil(scriptID),
								Script:     "updated script",
								Configs:    "otelEndpointConfig: {url: example.com}",
								FrequencyS: 1,
							},
						},
					},
					Timestamp: 1,
				},
			},
		},
		{
			name:     "tracks updates to cron scripts",
			queryStr: "second updated script",
			updates: []*cvmsgspb.CronScriptUpdate{
				{
					Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{
						UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{
							Script: &cvmsgspb.CronScript{
								ID:         utils.ProtoFromUUIDStrOrNil(scriptID),
								Script:     "updated script",
								Configs:    "otelEndpointConfig: {url: example.com}",
								FrequencyS: 1,
							},
						},
					},
					Timestamp: 1,
				},
				{
					Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{
						UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{
							Script: &cvmsgspb.CronScript{
								ID:         utils.ProtoFromUUIDStrOrNil(scriptID),
								Script:     "second updated script",
								Configs:    "otelEndpointConfig: {url: example.com}",
								FrequencyS: 1,
							},
						},
					},
					Timestamp: 2,
				},
			},
		},
	}

	for _, test := range tests {
		t.Run(test.name, func(t *testing.T) {
			ctrl := gomock.NewController(t)
			mvsExecuteScriptClient := mock_vizierpb.NewMockVizierService_ExecuteScriptClient(ctrl)
			mvsExecuteScriptClient.EXPECT().
				Recv().
				Return(nil, io.EOF).
				Times(1)

			scriptExecuted := make(chan struct{}, 1)
			mvs := mock_vizierpb.NewMockVizierServiceClient(ctrl)
			mvs.EXPECT().
				ExecuteScript(
					gomock.Not(gomock.Nil()),
					NewCustomMatcher(
						"an ExecuteScriptRequest with the proper QueryName amd QueryStr",
						func(req *vizierpb.ExecuteScriptRequest) bool {
							return req.GetQueryName() == "cron_"+scriptID && req.GetQueryStr() == test.queryStr
						},
					),
				).
				Do(func(_ context.Context, _ *vizierpb.ExecuteScriptRequest) { scriptExecuted <- struct{}{} }).
				Return(mvsExecuteScriptClient, nil).
				Times(1)

			fcs := &fakeCronStore{scripts: map[uuid.UUID]*cvmsgspb.CronScript{}}
			source := &TestSource{
				stopDelegate: func() {},
				startDelegate: func(_ context.Context, updatesCh chan<- *cvmsgspb.CronScriptUpdate) (map[string]*cvmsgspb.CronScript, error) {
					for _, update := range test.updates {
						updatesCh <- update
					}
					return map[string]*cvmsgspb.CronScript{}, nil
				},
			}
			sr := New(fcs, mvs, "test", source)
			defer sr.Stop()

			go func() {
				require.NoError(t, sr.SyncScripts())
			}()

			requireReceiveWithin(t, scriptExecuted, 10*time.Second)
		})
	}
}