-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e dra: collect and check GRPC calls
If kubelet plugin registration fails, it would be good to know more about the communication with kubelet. Capturing the GRPC calls and then checking that makes the failure messages more informative. Here's an example where a failure was triggered by temporarily modifying the check so that it didn't find the call: [FAILED] Timed out after 30.000s. Expected: <[]app.GRPCCall | len:2, cap:2>: [ { FullMethod: "/pluginregistration.Registration/GetInfo", Request: {}, Response: endpoint: /var/lib/kubelet/plugins/test-driver/dra.sock name: test-driver.cdi.k8s.io supported_versions: - 1.0.0 type: DRAPlugin, Err: nil, }, { FullMethod: "/pluginregistration.Registration/NotifyRegistrationStatus", Request: plugin_registered: true, Response: {}, Err: nil, }, ] to contain successful NotifyRegistrationStatus call
- Loading branch information
Showing
6 changed files
with
103 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Copyright 2023 The Kubernetes 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 app | ||
|
||
import ( | ||
"github.com/onsi/gomega/gcustom" | ||
) | ||
|
||
// BeRegistered checks that plugin registration has completed. | ||
var BeRegistered = gcustom.MakeMatcher(func(actualCalls []GRPCCall) (bool, error) { | ||
for _, call := range actualCalls { | ||
if call.FullMethod == "/pluginregistration.Registration/NotifyRegistrationStatus" && | ||
call.Err == nil { | ||
return true, nil | ||
} | ||
} | ||
return false, nil | ||
}).WithMessage("contain successful NotifyRegistrationStatus call") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters