mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-28 15:03:23 +00:00
fa5a4ac499
This change udpates the ldcache locator to read the ldcache at construction and use these contents to perform future lookups against. Each of the cache entries are resolved and lookups return the resolved target. Assuming a symlink chain: libcuda.so -> libcuda.so.1 -> libcuda.so.VERSION, this means that libcuda.so.VERION will be returned for any of the following inputs: libcuda.so, libcuda.so.1, libcudal.so.*. Signed-off-by: Evan Lezar <elezar@nvidia.com>
68 lines
1.5 KiB
Go
68 lines
1.5 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package ldcache
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// Ensure, that LDCacheMock does implement LDCache.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ LDCache = &LDCacheMock{}
|
|
|
|
// LDCacheMock is a mock implementation of LDCache.
|
|
//
|
|
// func TestSomethingThatUsesLDCache(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked LDCache
|
|
// mockedLDCache := &LDCacheMock{
|
|
// ListFunc: func() ([]string, []string) {
|
|
// panic("mock out the List method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedLDCache in code that requires LDCache
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type LDCacheMock struct {
|
|
// ListFunc mocks the List method.
|
|
ListFunc func() ([]string, []string)
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// List holds details about calls to the List method.
|
|
List []struct {
|
|
}
|
|
}
|
|
lockList sync.RWMutex
|
|
}
|
|
|
|
// List calls ListFunc.
|
|
func (mock *LDCacheMock) List() ([]string, []string) {
|
|
if mock.ListFunc == nil {
|
|
panic("LDCacheMock.ListFunc: method is nil but LDCache.List was just called")
|
|
}
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockList.Lock()
|
|
mock.calls.List = append(mock.calls.List, callInfo)
|
|
mock.lockList.Unlock()
|
|
return mock.ListFunc()
|
|
}
|
|
|
|
// ListCalls gets all the calls that were made to List.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedLDCache.ListCalls())
|
|
func (mock *LDCacheMock) ListCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockList.RLock()
|
|
calls = mock.calls.List
|
|
mock.lockList.RUnlock()
|
|
return calls
|
|
}
|