Skip to content

Commit

Permalink
revert json config
Browse files Browse the repository at this point in the history
  • Loading branch information
janardhankrishna-sai committed Dec 23, 2024
1 parent 9bb1ed8 commit eca81f1
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 77 deletions.
130 changes: 65 additions & 65 deletions test/healthcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ func (s) TestHealthCheckWatchStateChange(t *testing.T) {
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, `{
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"round_robin":{}}]
}`)})
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"round_robin":{}}]
}`)})

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand Down Expand Up @@ -309,11 +309,11 @@ func (s) TestHealthCheckHealthServerNotRegistered(t *testing.T) {
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand All @@ -336,11 +336,11 @@ func (s) TestHealthCheckWithGoAway(t *testing.T) {
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand Down Expand Up @@ -414,11 +414,11 @@ func (s) TestHealthCheckWithConnClose(t *testing.T) {
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand Down Expand Up @@ -462,11 +462,11 @@ func (s) TestHealthCheckWithAddrConnDrain(t *testing.T) {
cc, r := setupClient(t, &clientConfig{})
tc := testgrpc.NewTestServiceClient(cc)
sc := parseServiceConfig(t, r, fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: sc,
Expand Down Expand Up @@ -544,11 +544,11 @@ func (s) TestHealthCheckWithClientConnClose(t *testing.T) {
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, (fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName)))})
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName)))})

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand Down Expand Up @@ -611,11 +611,11 @@ func (s) TestHealthCheckWithoutSetConnectivityStateCalledAddrConnShutDown(t *tes
// back to client immediately upon receiving the request (client should receive no response until
// test ends).
sc := parseServiceConfig(t, r, fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "delay"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))
"healthCheckConfig": {
"serviceName": "delay"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: sc,
Expand Down Expand Up @@ -676,11 +676,11 @@ func (s) TestHealthCheckWithoutSetConnectivityStateCalled(t *testing.T) {
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "delay"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})
"healthCheckConfig": {
"serviceName": "delay"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})

select {
case <-hcExitChan:
Expand Down Expand Up @@ -714,11 +714,11 @@ func testHealthCheckDisableWithDialOption(t *testing.T, addr string) {
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: addr}},
ServiceConfig: parseServiceConfig(t, r, fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand Down Expand Up @@ -746,11 +746,11 @@ func testHealthCheckDisableWithBalancer(t *testing.T, addr string) {
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: addr}},
ServiceConfig: parseServiceConfig(t, r, `{
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"pick_first":{}}]
}`)})
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"pick_first":{}}]
}`)})

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand Down Expand Up @@ -820,11 +820,11 @@ func (s) TestHealthCheckChannelzCountingCallSuccess(t *testing.T) {
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "channelzSuccess"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})
"healthCheckConfig": {
"serviceName": "channelzSuccess"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})

if err := verifyResultWithDelay(func() (bool, error) {
cm, _ := channelz.GetTopChannels(0, 0)
Expand Down Expand Up @@ -869,11 +869,11 @@ func (s) TestHealthCheckChannelzCountingCallFailure(t *testing.T) {
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "channelzFailure"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})
"healthCheckConfig": {
"serviceName": "channelzFailure"
},
"loadBalancingConfig": [{"%s":{}}]
}`, healthCheckTestPolicyName))})

if err := verifyResultWithDelay(func() (bool, error) {
cm, _ := channelz.GetTopChannels(0, 0)
Expand Down Expand Up @@ -1251,11 +1251,11 @@ func (s) TestHealthCheckUnregisterHealthListener(t *testing.T) {

_, r := setupClient(t, nil)
svcCfg := fmt.Sprintf(`{
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, t.Name())
"healthCheckConfig": {
"serviceName": "foo"
},
"loadBalancingConfig": [{"%s":{}}]
}`, t.Name())
r.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
ServiceConfig: parseServiceConfig(t, r, svcCfg)})
Expand Down
18 changes: 9 additions & 9 deletions test/resolver_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ func (s) TestResolverUpdate_InvalidServiceConfigAfterGoodUpdate(t *testing.T) {
addrs := []resolver.Address{{Addr: backend.Address}}
const lbCfg = "wrapping balancer LB policy config"
goodSC := r.CC.ParseServiceConfig(fmt.Sprintf(`
{
"loadBalancingConfig": [
{
"%v": {
"config": "%s"
}
}
]
}`, t.Name(), lbCfg))
{
"loadBalancingConfig": [
{
"%v": {
"config": "%s"
}
}
]
}`, t.Name(), lbCfg))
r.UpdateState(resolver.State{Addresses: addrs, ServiceConfig: goodSC})

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
Expand Down
6 changes: 3 additions & 3 deletions test/xds/xds_client_certificate_providers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ func (s) TestClientSideXDS_WithNoCertificateProvidersInBootstrap_Failure(t *test
nodeID := uuid.New().String()
bc, err := bootstrap.NewContentsForTesting(bootstrap.ConfigOptionsForTesting{
Servers: []byte(fmt.Sprintf(`[{
"server_uri": %q,
"channel_creds": [{"type": "insecure"}]
}]`, mgmtServer.Address)),
"server_uri": %q,
"channel_creds": [{"type": "insecure"}]
}]`, mgmtServer.Address)),
Node: []byte(fmt.Sprintf(`{"id": "%s"}`, nodeID)),
})
if err != nil {
Expand Down

0 comments on commit eca81f1

Please sign in to comment.