@@ -78,9 +78,10 @@ import (
7878// function to call as the actual test. Available functions are: 
7979//   - testSyncSnapshot - calls syncSnapshot on the first snapshot in initialSnapshots. 
8080//   - testSyncSnapshotError - calls syncSnapshot on the first snapshot in initialSnapshots 
81- //                           and expects an error to be returned. 
81+ //     and expects an error to be returned. 
8282//   - testSyncContent - calls syncContent on the first content in initialContents. 
8383//   - any custom function for specialized tests. 
84+ // 
8485// The test then contains list of contents/snapshots that are expected at the end 
8586// of the test and list of generated events. 
8687type  controllerTest  struct  {
@@ -127,21 +128,21 @@ var (
127128
128129// snapshotReactor is a core.Reactor that simulates etcd and API server. It 
129130// stores: 
130- // - Latest version of snapshots contents saved by the controller. 
131- // - Queue of all saves (to simulate "content/snapshot updated" events). This queue 
132- //   contains all intermediate state of an object - e.g. a snapshot.VolumeName 
133- //   is updated first and snapshot.Phase second. This queue will then contain both 
134- //   updates as separate entries. 
135- // - Number of changes since the last call to snapshotReactor.syncAll(). 
136- // - Optionally, content and snapshot fake watchers which should be the same ones 
137- //   used by the controller. Any time an event function like deleteContentEvent 
138- //   is called to simulate an event, the reactor's stores are updated and the 
139- //   controller is sent the event via the fake watcher. 
140- // - Optionally, list of error that should be returned by reactor, simulating 
141- //   etcd / API server failures. These errors are evaluated in order and every 
142- //   error is returned only once. I.e. when the reactor finds matching 
143- //   reactorError, it return appropriate error and removes the reactorError from 
144- //   the list. 
131+ //    - Latest version of snapshots contents saved by the controller. 
132+ //    - Queue of all saves (to simulate "content/snapshot updated" events). This queue 
133+ //      contains all intermediate state of an object - e.g. a snapshot.VolumeName 
134+ //      is updated first and snapshot.Phase second. This queue will then contain both 
135+ //      updates as separate entries. 
136+ //    - Number of changes since the last call to snapshotReactor.syncAll(). 
137+ //    - Optionally, content and snapshot fake watchers which should be the same ones 
138+ //      used by the controller. Any time an event function like deleteContentEvent 
139+ //      is called to simulate an event, the reactor's stores are updated and the 
140+ //      controller is sent the event via the fake watcher. 
141+ //    - Optionally, list of error that should be returned by reactor, simulating 
142+ //      etcd / API server failures. These errors are evaluated in order and every 
143+ //      error is returned only once. I.e. when the reactor finds matching 
144+ //      reactorError, it return appropriate error and removes the reactorError from 
145+ //      the list. 
145146type  snapshotReactor  struct  {
146147	secrets               map [string ]* v1.Secret 
147148	volumes               map [string ]* v1.PersistentVolume 
@@ -1301,11 +1302,11 @@ var (
13011302)
13021303
13031304// wrapTestWithInjectedOperation returns a testCall that: 
1304- // - starts the controller and lets it run original testCall until 
1305- //   scheduleOperation() call. It blocks the controller there and calls the 
1306- //   injected function to simulate that something is happening when the 
1307- //   controller waits for the operation lock. Controller is then resumed and we 
1308- //   check how it behaves. 
1305+ //    - starts the controller and lets it run original testCall until 
1306+ //      scheduleOperation() call. It blocks the controller there and calls the 
1307+ //      injected function to simulate that something is happening when the 
1308+ //      controller waits for the operation lock. Controller is then resumed and we 
1309+ //      check how it behaves. 
13091310func  wrapTestWithInjectedOperation (toWrap  testCall , injectBeforeOperation  func (ctrl  * csiSnapshotCommonController , reactor  * snapshotReactor )) testCall  {
13101311	return  func (ctrl  * csiSnapshotCommonController , reactor  * snapshotReactor , test  controllerTest ) error  {
13111312		// Inject a hook before async operation starts 
@@ -1348,10 +1349,10 @@ func evaluateTestResults(ctrl *csiSnapshotCommonController, reactor *snapshotRea
13481349
13491350// Test single call to syncSnapshot and syncContent methods. 
13501351// For all tests: 
1351- // 1. Fill in the controller with initial data 
1352- // 2. Call the tested function (syncSnapshot/syncContent) via 
1353- //    controllerTest.testCall *once*. 
1354- // 3. Compare resulting contents and snapshots with expected contents and snapshots. 
1352+ //   1. Fill in the controller with initial data 
1353+ //   2. Call the tested function (syncSnapshot/syncContent) via 
1354+ //      controllerTest.testCall *once*. 
1355+ //   3. Compare resulting contents and snapshots with expected contents and snapshots. 
13551356func  runSyncTests (t  * testing.T , tests  []controllerTest , snapshotClasses  []* crdv1.VolumeSnapshotClass ) {
13561357	snapshotscheme .AddToScheme (scheme .Scheme )
13571358	for  _ , test  :=  range  tests  {
0 commit comments