Merge pull request #690 from humblec/rbac

replace serviceAccountName key, rbac and cleanup in the code
This commit is contained in:
Kubernetes Prow Robot
2022-04-25 07:39:39 -07:00
committed by GitHub
19 changed files with 69 additions and 67 deletions

View File

@@ -112,14 +112,18 @@ type controllerTest struct {
type testCall func(ctrl *csiSnapshotCommonController, reactor *snapshotReactor, test controllerTest) error
const testNamespace = "default"
const mockDriverName = "csi-mock-plugin"
const (
testNamespace = "default"
mockDriverName = "csi-mock-plugin"
)
var errVersionConflict = errors.New("VersionError")
var nocontents []*crdv1.VolumeSnapshotContent
var nosnapshots []*crdv1.VolumeSnapshot
var noevents = []string{}
var noerrors = []reactorError{}
var (
errVersionConflict = errors.New("VersionError")
nocontents []*crdv1.VolumeSnapshotContent
nosnapshots []*crdv1.VolumeSnapshot
noevents = []string{}
noerrors = []reactorError{}
)
// snapshotReactor is a core.Reactor that simulates etcd and API server. It
// stores:
@@ -921,6 +925,7 @@ func withSnapshotContentInvalidLabel(contents []*crdv1.VolumeSnapshotContent) []
}
return contents
}
func withContentAnnotations(contents []*crdv1.VolumeSnapshotContent, annotations map[string]string) []*crdv1.VolumeSnapshotContent {
for i := range contents {
if contents[i].ObjectMeta.Annotations == nil {
@@ -1200,7 +1205,6 @@ func testSyncSnapshot(ctrl *csiSnapshotCommonController, reactor *snapshotReacto
func testSyncSnapshotError(ctrl *csiSnapshotCommonController, reactor *snapshotReactor, test controllerTest) error {
err := ctrl.syncSnapshot(test.initialSnapshots[0])
if err != nil {
return nil
}
@@ -1303,7 +1307,6 @@ var (
// controller waits for the operation lock. Controller is then resumed and we
// check how it behaves.
func wrapTestWithInjectedOperation(toWrap testCall, injectBeforeOperation func(ctrl *csiSnapshotCommonController, reactor *snapshotReactor)) testCall {
return func(ctrl *csiSnapshotCommonController, reactor *snapshotReactor, test controllerTest) error {
// Inject a hook before async operation starts
klog.V(4).Infof("reactor:injecting call")