mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #93950 from Jiawei0227/parse-mock-logs
Make CSI mock driver log parse more flexible
This commit is contained in:
commit
5507cb772b
@ -71,6 +71,8 @@ const (
|
|||||||
driverPodName = "csi-mockplugin-0"
|
driverPodName = "csi-mockplugin-0"
|
||||||
// Name of CSI driver container name
|
// Name of CSI driver container name
|
||||||
driverContainerName = "mock"
|
driverContainerName = "mock"
|
||||||
|
// Prefix of the mock driver grpc log
|
||||||
|
grpcCallPrefix = "gRPCCall:"
|
||||||
)
|
)
|
||||||
|
|
||||||
// csiCall represents an expected call from Kubernetes to CSI mock driver and
|
// csiCall represents an expected call from Kubernetes to CSI mock driver and
|
||||||
@ -1381,10 +1383,11 @@ func parseMockLogs(cs clientset.Interface, namespace, driverPodName, driverConta
|
|||||||
logLines := strings.Split(log, "\n")
|
logLines := strings.Split(log, "\n")
|
||||||
var calls []mockCSICall
|
var calls []mockCSICall
|
||||||
for _, line := range logLines {
|
for _, line := range logLines {
|
||||||
if !strings.HasPrefix(line, "gRPCCall:") {
|
index := strings.Index(line, grpcCallPrefix)
|
||||||
|
if index == -1 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
line = strings.TrimPrefix(line, "gRPCCall:")
|
line = line[index+len(grpcCallPrefix):]
|
||||||
call := mockCSICall{
|
call := mockCSICall{
|
||||||
json: string(line),
|
json: string(line),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user