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: config_test.go
    path of file: ./repos/sharingan/grpc-server/v1.33.2/balancer/rls/internal
    
    the code of the file until where you have to start completion: /*
 *
 * Copyright 2020 gRPC 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 rls

import (
	"encoding/json"
	"fmt"
	"strings"
	"testing"
	"time"

	"github.com/google/go-cmp/cmp"

	"google.golang.org/grpc/balancer"
	_ "google.golang.org/grpc/balancer/grpclb"               // grpclb for config parsing.
	_ "google.golang.org/grpc/internal/resolver/passthrough" // passthrough resolver.
)

const balancerWithoutConfigParserName = "dummy_balancer"

type dummyBB struct {
	balancer.Builder
}

func (*dummyBB) Name() string {
	return balancerWithoutConfigParserName
}

func init() {
	balancer.Register(&dummyBB{})
}

// testEqual reports whether the lbCfgs a and b are equal. This is to be used
// only from tests. This ignores the keyBuilderMap field because its internals
// are not exported, and hence not possible to specify in the want section of
// the test. This is fine because we already have tests to make sure that the
// keyBuilder is parsed properly from the service config.
func testEqual(a, b *lbConfig) bool {
	return a.lookupService == b.lookupService &&
		a.lookupServiceTimeout == b.lookupServiceTimeout &&
		a.maxAge == b.maxAge &&
		a.staleAge == b.staleAge &&
		a.cacheSizeBytes == b.cacheSizeBytes &&
		a.defaultTarget == b.defaultTarget &&
		a.cpName == b.cpName &&
		a.cpTargetField == b.cpTargetField &&
		cmp.Equal(a.cpConfig, b.cpConfig)
}

func TestParseConfig(t *testing.T) {
	tests := []struct {
		desc    string
		input   []byte
		wantCfg *lbConfig
	}{
		// This input validates a few cases:
		// - A top-level unknown field should not fail.
		// - An unknown field in routeLookupConfig proto should not fail.
		// - lookupServiceTimeout is set to its default value, since it is not specified in the input.
		// 
    
func TestParseConfig(t *testing.T) {
	tests := []struct {
		desc    string
		input   []byte
		wantCfg *lbConfig
	}{
		// This input validates a few cases:
		// - A top-level unknown field should not fail.
		// - An unknown field in routeLookupConfig proto should not fail.
		// - lookupServiceTimeout is set to its default value, since it is not specified in the input.
		// - maxAge is set to maxMaxAge since the value is too large in the input.
		// - staleAge is ignore because it is higher than maxAge in the input.
		{
			desc: "with transformations",
			input: []byte(`{
				"top-level-unknown-field": "unknown-value",
				"routeLookupConfig": {
					"unknown-field": "unknown-value",
					"grpcKeybuilders": [{
						"names": [{"service": "service", "method": "method"}],
						"headers": [{"key": "k1", "names": ["v1"]}]
					}],
					"lookupService": "passthrough:///target",
					"maxAge" : "500s",
					"staleAge": "600s",
					"cacheSizeBytes": 1000,
					"defaultTarget": "passthrough:///default"
				},
				"childPolicy": [
					{"cds_experimental": {"Cluster": "my-fav-cluster"}},
					{"unknown-policy": {"unknown-field": "unknown-value"}},
					{"grpclb": {"childPolicy": [{"pickfirst": {}}]}}
				],
				"childPolicyConfigTargetFieldName": "service_name"
			}`),
			wantCfg: &lbConfig{
				lookupService:        "passthrough:///target",
				lookupServiceTimeout: 10 * time.Second, // This is the default value.
				maxAge:               5 * time.Minute,  // This is max maxAge.
				staleAge:             time.Duration(0), // StaleAge is ignore because it was higher than maxAge.
				cacheSizeBytes:       1000,
				defaultTarget:        "passthrough:///default",
				cpName:               "grpclb",
				cpTargetField:        "service_name",
				cpConfig:             map[string]json.RawMessage{"childPolicy": json.RawMessage(`[{"pickfirst": {}}]`)},
			},
		},
		{
			desc: "without transformations",
			input: []byte(`{
				"routeLookupConfig": {
					"grpcKeybuilders": [{
						"names": [{"service": "service", "method": "method"}],
						"headers": [{"key": "k1", "names": ["v1"]}]
					}],
					"lookupService": "passthrough:///target",
					"lookupServiceTimeout" : "100s",
					"maxAge": "60s",
					"staleAge" : "50s",
					"cacheSizeBytes": 1000,
					"defaultTarget": "passthrough:///default"
				},
				"childPolicy": [{"grpclb": {"childPolicy": [{"pickfirst": {}}]}}],
				"childPolicyConfigTargetFieldName": "service_name"
			}`),
			wantCfg: &lbConfig{
				lookupService:        "passthrough:///target",
				lookupServiceTimeout: 100 * time.Second,
				maxAge:               60 * time.Second,
				staleAge:             50 * time.Second,
				cacheSizeBytes:       1000,
				defaultTarget:        "passthrough:///default",
				cpName:               "grpclb",
				cpTargetField:        "service_name",
				cpConfig:             map[string]json.RawMessage{"childPolicy": json.RawMessage(`[{"pickfirst": {}}]`)},
			},
		},
	}

	builder := &rlsBB{}
	for _, test := range tests {
		t.Run(test.desc, func(t *testing.T) {
			lbCfg, err := builder.ParseConfig(test.input)
			if err != nil || !testEqual(lbCfg.(*lbConfig), test.wantCfg) {
				t.Errorf("ParseConfig(%s) = {%+v, %v}, want {%+v, nil}", string(test.input), lbCfg, err, test.wantCfg)
			}
		})
	}
}