Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CSI mock driver log parse more flexible #93950

Merged
merged 1 commit into from Aug 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions test/e2e/storage/csi_mock_volume.go
Expand Up @@ -69,6 +69,8 @@ const (
driverPodName = "csi-mockplugin-0"
// Name of CSI driver container name
driverContainerName = "mock"
// Prefix of the mock driver grpc log
grpcCallPrefix = "gRPCCall:"
)

// csiCall represents an expected call from Kubernetes to CSI mock driver and
Expand Down Expand Up @@ -1360,10 +1362,11 @@ func parseMockLogs(cs clientset.Interface, namespace, driverPodName, driverConta
logLines := strings.Split(log, "\n")
var calls []mockCSICall
for _, line := range logLines {
if !strings.HasPrefix(line, "gRPCCall:") {
index := strings.Index(line, grpcCallPrefix)
if index == -1 {
continue
}
line = strings.TrimPrefix(line, "gRPCCall:")
line = line[index+len(grpcCallPrefix):]
call := mockCSICall{
json: string(line),
}
Expand Down