Skip to content

Commit 137e7a3

Browse files
authored
Merge pull request #17 from YangKeao/fix-grpc-return
return response but not nil in `CancelDNSChaos`
2 parents 250909e + 3328aa7 commit 137e7a3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

grpc_server.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ func (k Kubernetes) CancelDNSChaos(ctx context.Context, req *pb.CancelDNSChaosRe
114114
defer k.Unlock()
115115

116116
if _, ok := k.chaosMap[req.Name]; !ok {
117-
return nil, nil
117+
return &pb.DNSChaosResponse{
118+
Result: true,
119+
}, nil
118120
}
119121

120122
for _, pod := range k.chaosMap[req.Name].Pods {
@@ -138,5 +140,7 @@ func (k Kubernetes) CancelDNSChaos(ctx context.Context, req *pb.CancelDNSChaosRe
138140

139141
delete(k.chaosMap, req.Name)
140142

141-
return nil, nil
143+
return &pb.DNSChaosResponse{
144+
Result: true,
145+
}, nil
142146
}

0 commit comments

Comments
 (0)