...

Source file src/k8s.io/kubernetes/test/e2e/dra/test-driver/app/gomega.go

Documentation: k8s.io/kubernetes/test/e2e/dra/test-driver/app

     1  /*
     2  Copyright 2023 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package app
    18  
    19  import (
    20  	"strings"
    21  
    22  	"github.com/onsi/gomega/gcustom"
    23  )
    24  
    25  // BeRegistered checks that plugin registration has completed.
    26  var BeRegistered = gcustom.MakeMatcher(func(actualCalls []GRPCCall) (bool, error) {
    27  	for _, call := range actualCalls {
    28  		if call.FullMethod == "/pluginregistration.Registration/NotifyRegistrationStatus" &&
    29  			call.Err == nil {
    30  			return true, nil
    31  		}
    32  	}
    33  	return false, nil
    34  }).WithMessage("contain successful NotifyRegistrationStatus call")
    35  
    36  // NodePrepareResouceCalled checks that NodePrepareResource API has been called
    37  var NodePrepareResourceCalled = gcustom.MakeMatcher(func(actualCalls []GRPCCall) (bool, error) {
    38  	for _, call := range actualCalls {
    39  		if strings.HasSuffix(call.FullMethod, "/NodePrepareResource") && call.Err == nil {
    40  			return true, nil
    41  		}
    42  	}
    43  	return false, nil
    44  }).WithMessage("contain NodePrepareResource call")
    45  
    46  // NodePrepareResoucesCalled checks that NodePrepareResources API has been called
    47  var NodePrepareResourcesCalled = gcustom.MakeMatcher(func(actualCalls []GRPCCall) (bool, error) {
    48  	for _, call := range actualCalls {
    49  		if strings.HasSuffix(call.FullMethod, "/NodePrepareResources") && call.Err == nil {
    50  			return true, nil
    51  		}
    52  	}
    53  	return false, nil
    54  }).WithMessage("contain NodePrepareResources call")
    55  

View as plain text