github.com/swiftstack/ProxyFS@v0.0.0-20210203235616-4017c267d62f/transitions/api_test.go (about)

     1  // Copyright (c) 2015-2021, NVIDIA CORPORATION.
     2  // SPDX-License-Identifier: Apache-2.0
     3  
     4  package transitions
     5  
     6  import (
     7  	"fmt"
     8  	"sort"
     9  	"testing"
    10  
    11  	"github.com/swiftstack/ProxyFS/conf"
    12  )
    13  
    14  type testCallbacksInterfaceStruct struct {
    15  	name string
    16  	t    *testing.T
    17  }
    18  
    19  var testConfStrings = []string{
    20  	"Logging.LogFilePath=/dev/null",
    21  	"Logging.LogToConsole=false",
    22  	"FlowControl:FlowControlX.MaxFlushSize=10000000",
    23  	"FlowControl:FlowControlX.MaxFlushTime=10s",
    24  	"FlowControl:FlowControlX.FileDefragmentChunkSize=10000000",
    25  	"FlowControl:FlowControlX.FileDefragmentChunkDelay=10ms",
    26  	"FlowControl:FlowControlX.ReadCacheLineSize=1000000",
    27  	"FlowControl:FlowControlX.ReadCacheWeight=100",
    28  	"FlowControl:FlowControlY.MaxFlushSize=20000000",
    29  	"FlowControl:FlowControlY.MaxFlushTime=20s",
    30  	"FlowControl:FlowControlY.FileDefragmentChunkSize=20000000",
    31  	"FlowControl:FlowControlY.FileDefragmentChunkDelay=20ms",
    32  	"FlowControl:FlowControlY.ReadCacheLineSize=2000000",
    33  	"FlowControl:FlowControlY.ReadCacheWeight=200",
    34  	"Volume:VolumeA.PrimaryPeer=Peer0",
    35  	"Volume:VolumeA.FlowControl=FlowControlX",
    36  	"Volume:VolumeB.PrimaryPeer=Peer0", // Will migrate to Peer1
    37  	"Volume:VolumeB.FlowControl=FlowControlY",
    38  	"Volume:VolumeC.PrimaryPeer=Peer1", // Will migrate to Peer2...then destroyed
    39  	"Volume:VolumeC.FlowControl=FlowControlX",
    40  	"Volume:VolumeD.PrimaryPeer=Peer2", // Will migrate to Peer0...then destroyed
    41  	"Volume:VolumeD.FlowControl=FlowControlY",
    42  	//                                     VolumeE will be created on Peer0
    43  	//                                     VolumeF will be created on Peer1
    44  	//                                     VolumeG will be created on Peer2...then migrate to VolumeF's VolumeGroup
    45  	"FSGlobals.VolumeList=VolumeA,VolumeB,VolumeC,VolumeD",
    46  	"FSGlobals.CheckpointHeaderConsensusAttempts=5",
    47  	"FSGlobals.MountRetryLimit=6",
    48  	"FSGlobals.MountRetryDelay=1s",
    49  	"FSGlobals.MountRetryExpBackoff=2",
    50  	"FSGlobals.LogCheckpointHeaderPosts=true",
    51  	"FSGlobals.TryLockBackoffMin=10ms",
    52  	"FSGlobals.TryLockBackoffMax=50ms",
    53  	"FSGlobals.TryLockSerializationThreshhold=5",
    54  	"FSGlobals.SymlinkMax=32",
    55  	"FSGlobals.CoalesceElementChunkSize=16",
    56  	"Cluster.Peers=Peer0,Peer1,Peer2,Peer3",
    57  	"Cluster.WhoAmI=Peer0",
    58  	"Transitions.AutoVolumeGroupPrefix=V_",
    59  	"Transitions.AutoVolumeGroupSuffix=_G",
    60  }
    61  
    62  var testConfStringsToAddVolumeE = []string{
    63  	"Volume:VolumeE.MaxFlushSize=30000000",
    64  	"Volume:VolumeE.MaxFlushTime=30s",
    65  	"Volume:VolumeE.FileDefragmentChunkSize=30000000",
    66  	"Volume:VolumeE.FileDefragmentChunkDelay=30ms",
    67  	"VolumeGroup:VG_One.PrimaryPeer=Peer0",
    68  	"VolumeGroup:VG_One.ReadCacheLineSize=3000000",
    69  	"VolumeGroup:VG_One.ReadCacheWeight=300",
    70  	"VolumeGroup:VG_One.VirtualIPAddr=",
    71  	"VolumeGroup:VG_One.VolumeList=VolumeE",
    72  	"FSGlobals.VolumeGroupList=V_VolumeA_G,V_VolumeB_G,VG_One",
    73  }
    74  
    75  var testConfStringsToAddVolumeF = []string{
    76  	"Volume:VolumeF.MaxFlushSize=40000000",
    77  	"Volume:VolumeF.MaxFlushTime=40s",
    78  	"Volume:VolumeF.FileDefragmentChunkSize=40000000",
    79  	"Volume:VolumeF.FileDefragmentChunkDelay=40ms",
    80  	"VolumeGroup:VG_Two.PrimaryPeer=Peer1",
    81  	"VolumeGroup:VG_Two.ReadCacheLineSize=4000000",
    82  	"VolumeGroup:VG_Two.ReadCacheWeight=400",
    83  	"VolumeGroup:VG_Two.VirtualIPAddr=",
    84  	"VolumeGroup:VG_Two.VolumeList=VolumeF",
    85  	"FSGlobals.VolumeGroupList=V_VolumeA_G,V_VolumeB_G,VG_One,VG_Two",
    86  }
    87  
    88  var testConfStringsToAddVolumeG = []string{
    89  	"Volume:VolumeG.MaxFlushSize=50000000",
    90  	"Volume:VolumeG.MaxFlushTime=50s",
    91  	"Volume:VolumeG.FileDefragmentChunkSize=50000000",
    92  	"Volume:VolumeG.FileDefragmentChunkDelay=50ms",
    93  	"VolumeGroup:VG_Three.PrimaryPeer=Peer2",
    94  	"VolumeGroup:VG_Three.ReadCacheLineSize=5000000",
    95  	"VolumeGroup:VG_Three.ReadCacheWeight=500",
    96  	"VolumeGroup:VG_Three.VirtualIPAddr=",
    97  	"VolumeGroup:VG_Three.VolumeList=VolumeG",
    98  	"FSGlobals.VolumeGroupList=V_VolumeA_G,V_VolumeB_G,VG_One,VG_Two,VG_Three",
    99  }
   100  
   101  var testConfStringsToMoveVolumeG = []string{
   102  	"VolumeGroup:VG_Two.VolumeList=VolumeF,VolumeG",
   103  	"VolumeGroup:VG_Three.VolumeList=",
   104  	"FSGlobals.VolumeGroupList=V_VolumeA_G,V_VolumeB_G,VG_One,VG_Two,VG_Three",
   105  }
   106  
   107  var testCallbackLog []string // Accumulates log messages output by transitions.Callbacks implementations
   108  
   109  func testValidateUpgradedConfMap(t *testing.T, testConfMap conf.ConfMap) {
   110  	var (
   111  		fileDefragmentChunkDelay   conf.ConfMapOption
   112  		fileDefragmentChunkDelayOK bool
   113  		fileDefragmentChunkSize    conf.ConfMapOption
   114  		fileDefragmentChunkSizeOK  bool
   115  		fsGlobals                  conf.ConfMapSection
   116  		fsGlobalsOK                bool
   117  		maxFlushSize               conf.ConfMapOption
   118  		maxFlushSizeOK             bool
   119  		maxFlushTime               conf.ConfMapOption
   120  		maxFlushTimeOK             bool
   121  		primaryPeer                conf.ConfMapOption
   122  		primaryPeerOK              bool
   123  		readCacheLineSize          conf.ConfMapOption
   124  		readCacheLineSizeOK        bool
   125  		readCacheWeight            conf.ConfMapOption
   126  		readCacheWeightOK          bool
   127  		testVolume                 conf.ConfMapSection
   128  		testVolumeGroup            conf.ConfMapSection
   129  		testVolumeGroupOK          bool
   130  		testVolumeOK               bool
   131  		virtualIPAddr              conf.ConfMapOption
   132  		virtualIPAddrOK            bool
   133  		volumeGroupList            conf.ConfMapOption
   134  		volumeGroupListOK          bool
   135  		volumeList                 conf.ConfMapOption
   136  		volumeListOK               bool
   137  	)
   138  
   139  	// Validate FSGlobals
   140  
   141  	fsGlobals, fsGlobalsOK = testConfMap["FSGlobals"]
   142  	if !fsGlobalsOK {
   143  		t.Fatalf("testConfMap must contain an FSGlobals section")
   144  	}
   145  
   146  	volumeGroupList, volumeGroupListOK = fsGlobals["VolumeGroupList"]
   147  	if !volumeGroupListOK || (4 != len(volumeGroupList)) || ("V_VolumeA_G" != volumeGroupList[0]) || ("V_VolumeB_G" != volumeGroupList[1]) || ("V_VolumeC_G" != volumeGroupList[2]) || ("V_VolumeD_G" != volumeGroupList[3]) {
   148  		t.Fatalf("testConfMap missing FSGlobals.VolumeGroupList=V_VolumeA_G,V_VolumeB_G,V_VolumeC_G,V_VolumeD_G")
   149  	}
   150  
   151  	// Validate VolumeGroup:V_VolumeA_G
   152  
   153  	testVolumeGroup, testVolumeGroupOK = testConfMap["VolumeGroup:V_VolumeA_G"]
   154  	if !testVolumeGroupOK {
   155  		t.Fatalf("testConfMap must contain a VolumeGroup:V_VolumeA_G section")
   156  	}
   157  
   158  	volumeList, volumeListOK = testVolumeGroup["VolumeList"]
   159  	if !volumeListOK || (1 != len(volumeList)) || ("VolumeA" != volumeList[0]) {
   160  		t.Fatalf("testConfMap missing VolumeGroup:VolumeA.VolumeList=VolumeA")
   161  	}
   162  	virtualIPAddr, virtualIPAddrOK = testVolumeGroup["VirtualIPAddr"]
   163  	if !virtualIPAddrOK || (0 != len(virtualIPAddr)) {
   164  		t.Fatalf("testConfMap missing VolumeGroup:VolumeA.VirtualIPAddr=")
   165  	}
   166  	primaryPeer, primaryPeerOK = testVolumeGroup["PrimaryPeer"]
   167  	if !primaryPeerOK || (1 != len(primaryPeer)) || ("Peer0" != primaryPeer[0]) {
   168  		t.Fatalf("testConfMap missing VolumeGroup:VolumeA.PrimaryPeer=Peer0")
   169  	}
   170  	readCacheLineSize, readCacheLineSizeOK = testVolumeGroup["ReadCacheLineSize"]
   171  	if !readCacheLineSizeOK || (1 != len(readCacheLineSize)) || ("1000000" != readCacheLineSize[0]) {
   172  		t.Fatalf("testConfMap missing VolumeGroup:VolumeA.ReadCacheLineSize=1000000")
   173  	}
   174  	readCacheWeight, readCacheWeightOK = testVolumeGroup["ReadCacheWeight"]
   175  	if !readCacheWeightOK || (1 != len(readCacheWeight)) || ("100" != readCacheWeight[0]) {
   176  		t.Fatalf("testConfMap missing VolumeGroup:VolumeA.ReadCacheWeight=100")
   177  	}
   178  
   179  	testVolume, testVolumeOK = testConfMap["Volume:VolumeA"]
   180  	if !testVolumeOK {
   181  		t.Fatalf("testConfMap must contain a Volume:VolumeA section")
   182  	}
   183  
   184  	maxFlushSize, maxFlushSizeOK = testVolume["MaxFlushSize"]
   185  	if !maxFlushSizeOK || (1 != len(maxFlushSize)) || ("10000000" != maxFlushSize[0]) {
   186  		t.Fatalf("testConfMap missing Volume:VolumeA.MaxFlushSize=10000000")
   187  	}
   188  	maxFlushTime, maxFlushTimeOK = testVolume["MaxFlushTime"]
   189  	if !maxFlushTimeOK || (1 != len(maxFlushTime)) || ("10s" != maxFlushTime[0]) {
   190  		t.Fatalf("testConfMap missing Volume:VolumeA.MaxFlushTime=10s")
   191  	}
   192  
   193  	fileDefragmentChunkSize, fileDefragmentChunkSizeOK = testVolume["FileDefragmentChunkSize"]
   194  	if !fileDefragmentChunkSizeOK || (1 != len(fileDefragmentChunkSize)) || ("10000000" != fileDefragmentChunkSize[0]) {
   195  		t.Fatalf("testConfigMap has invalid Volume:VolumeA.FileDefragmentChunkSize")
   196  	}
   197  	fileDefragmentChunkDelay, fileDefragmentChunkDelayOK = testVolume["FileDefragmentChunkDelay"]
   198  	if !fileDefragmentChunkDelayOK || (1 != len(fileDefragmentChunkDelay)) || ("10ms" != fileDefragmentChunkDelay[0]) {
   199  		t.Fatalf("testConfigMap has invalid Volume:VolumeA.FileDefragmentChunkDelay")
   200  	}
   201  
   202  	// Validate VolumeGroup:V_VolumeB_G
   203  
   204  	testVolumeGroup, testVolumeGroupOK = testConfMap["VolumeGroup:V_VolumeB_G"]
   205  	if !testVolumeGroupOK {
   206  		t.Fatalf("testConfMap must contain a VolumeGroup:V_VolumeB_G section")
   207  	}
   208  
   209  	volumeList, volumeListOK = testVolumeGroup["VolumeList"]
   210  	if !volumeListOK || (1 != len(volumeList)) || ("VolumeB" != volumeList[0]) {
   211  		t.Fatalf("testConfMap missing VolumeGroup:VolumeB.VolumeList=VolumeB")
   212  	}
   213  	virtualIPAddr, virtualIPAddrOK = testVolumeGroup["VirtualIPAddr"]
   214  	if !virtualIPAddrOK || (0 != len(virtualIPAddr)) {
   215  		t.Fatalf("testConfMap missing VolumeGroup:VolumeB.VirtualIPAddr=")
   216  	}
   217  	primaryPeer, primaryPeerOK = testVolumeGroup["PrimaryPeer"]
   218  	if !primaryPeerOK || (1 != len(primaryPeer)) || ("Peer0" != primaryPeer[0]) {
   219  		t.Fatalf("testConfMap missing VolumeGroup:VolumeB.PrimaryPeer=Peer0")
   220  	}
   221  	readCacheLineSize, readCacheLineSizeOK = testVolumeGroup["ReadCacheLineSize"]
   222  	if !readCacheLineSizeOK || (1 != len(readCacheLineSize)) || ("2000000" != readCacheLineSize[0]) {
   223  		t.Fatalf("testConfMap missing VolumeGroup:VolumeB.ReadCacheLineSize=2000000")
   224  	}
   225  	readCacheWeight, readCacheWeightOK = testVolumeGroup["ReadCacheWeight"]
   226  	if !readCacheWeightOK || (1 != len(readCacheWeight)) || ("200" != readCacheWeight[0]) {
   227  		t.Fatalf("testConfMap missing VolumeGroup:VolumeB.ReadCacheWeight=200")
   228  	}
   229  
   230  	testVolume, testVolumeOK = testConfMap["Volume:VolumeB"]
   231  	if !testVolumeOK {
   232  		t.Fatalf("testConfMap must contain a Volume:VolumeB section")
   233  	}
   234  
   235  	maxFlushSize, maxFlushSizeOK = testVolume["MaxFlushSize"]
   236  	if !maxFlushSizeOK || (1 != len(maxFlushSize)) || ("20000000" != maxFlushSize[0]) {
   237  		t.Fatalf("testConfMap missing Volume:VolumeB.MaxFlushSize=20000000")
   238  	}
   239  	maxFlushTime, maxFlushTimeOK = testVolume["MaxFlushTime"]
   240  	if !maxFlushTimeOK || (1 != len(maxFlushTime)) || ("20s" != maxFlushTime[0]) {
   241  		t.Fatalf("testConfMap missing Volume:VolumeB.MaxFlushTime=20s")
   242  	}
   243  
   244  	fileDefragmentChunkSize, fileDefragmentChunkSizeOK = testVolume["FileDefragmentChunkSize"]
   245  	if !fileDefragmentChunkSizeOK || (1 != len(fileDefragmentChunkSize)) || ("20000000" != fileDefragmentChunkSize[0]) {
   246  		t.Fatalf("testConfigMap has invalid Volume:VolumeB.FileDefragmentChunkSize")
   247  	}
   248  	fileDefragmentChunkDelay, fileDefragmentChunkDelayOK = testVolume["FileDefragmentChunkDelay"]
   249  	if !fileDefragmentChunkDelayOK || (1 != len(fileDefragmentChunkDelay)) || ("20ms" != fileDefragmentChunkDelay[0]) {
   250  		t.Fatalf("testConfigMap has invalid Volume:VolumeB.FileDefragmentChunkDelay")
   251  	}
   252  
   253  	// Validate VolumeGroup:V_VolumeC_G
   254  
   255  	testVolumeGroup, testVolumeGroupOK = testConfMap["VolumeGroup:V_VolumeC_G"]
   256  	if !testVolumeGroupOK {
   257  		t.Fatalf("testConfMap must contain a VolumeGroup:V_VolumeC_G section")
   258  	}
   259  
   260  	volumeList, volumeListOK = testVolumeGroup["VolumeList"]
   261  	if !volumeListOK || (1 != len(volumeList)) || ("VolumeC" != volumeList[0]) {
   262  		t.Fatalf("testConfMap missing VolumeGroup:VolumeC.VolumeList=VolumeC")
   263  	}
   264  	virtualIPAddr, virtualIPAddrOK = testVolumeGroup["VirtualIPAddr"]
   265  	if !virtualIPAddrOK || (0 != len(virtualIPAddr)) {
   266  		t.Fatalf("testConfMap missing VolumeGroup:VolumeC.VirtualIPAddr=")
   267  	}
   268  	primaryPeer, primaryPeerOK = testVolumeGroup["PrimaryPeer"]
   269  	if !primaryPeerOK || (1 != len(primaryPeer)) || ("Peer1" != primaryPeer[0]) {
   270  		t.Fatalf("testConfMap missing VolumeGroup:VolumeA.PrimaryPeer=Peer1")
   271  	}
   272  	readCacheLineSize, readCacheLineSizeOK = testVolumeGroup["ReadCacheLineSize"]
   273  	if !readCacheLineSizeOK || (1 != len(readCacheLineSize)) || ("1000000" != readCacheLineSize[0]) {
   274  		t.Fatalf("testConfMap missing VolumeGroup:VolumeC.ReadCacheLineSize=1000000")
   275  	}
   276  	readCacheWeight, readCacheWeightOK = testVolumeGroup["ReadCacheWeight"]
   277  	if !readCacheWeightOK || (1 != len(readCacheWeight)) || ("100" != readCacheWeight[0]) {
   278  		t.Fatalf("testConfMap missing VolumeGroup:VolumeC.ReadCacheWeight=100")
   279  	}
   280  
   281  	testVolume, testVolumeOK = testConfMap["Volume:VolumeC"]
   282  	if !testVolumeOK {
   283  		t.Fatalf("testConfMap must contain a Volume:VolumeC section")
   284  	}
   285  
   286  	maxFlushSize, maxFlushSizeOK = testVolume["MaxFlushSize"]
   287  	if !maxFlushSizeOK || (1 != len(maxFlushSize)) || ("10000000" != maxFlushSize[0]) {
   288  		t.Fatalf("testConfMap missing Volume:VolumeC.MaxFlushSize=10000000")
   289  	}
   290  	maxFlushTime, maxFlushTimeOK = testVolume["MaxFlushTime"]
   291  	if !maxFlushTimeOK || (1 != len(maxFlushTime)) || ("10s" != maxFlushTime[0]) {
   292  		t.Fatalf("testConfMap missing Volume:VolumeC.MaxFlushTime=10s")
   293  	}
   294  
   295  	fileDefragmentChunkSize, fileDefragmentChunkSizeOK = testVolume["FileDefragmentChunkSize"]
   296  	if !fileDefragmentChunkSizeOK || (1 != len(fileDefragmentChunkSize)) || ("10000000" != fileDefragmentChunkSize[0]) {
   297  		t.Fatalf("testConfigMap has invalid Volume:VolumeC.FileDefragmentChunkSize")
   298  	}
   299  	fileDefragmentChunkDelay, fileDefragmentChunkDelayOK = testVolume["FileDefragmentChunkDelay"]
   300  	if !fileDefragmentChunkDelayOK || (1 != len(fileDefragmentChunkDelay)) || ("10ms" != fileDefragmentChunkDelay[0]) {
   301  		t.Fatalf("testConfigMap has invalid Volume:VolumeC.FileDefragmentChunkDelay")
   302  	}
   303  
   304  	// Validate VolumeGroup:V_VolumeD_G
   305  
   306  	testVolumeGroup, testVolumeGroupOK = testConfMap["VolumeGroup:V_VolumeD_G"]
   307  	if !testVolumeGroupOK {
   308  		t.Fatalf("testConfMap must contain a VolumeGroup:V_VolumeD_G section")
   309  	}
   310  
   311  	volumeList, volumeListOK = testVolumeGroup["VolumeList"]
   312  	if !volumeListOK || (1 != len(volumeList)) || ("VolumeD" != volumeList[0]) {
   313  		t.Fatalf("testConfMap missing VolumeGroup:VolumeD.VolumeList=VolumeD")
   314  	}
   315  	virtualIPAddr, virtualIPAddrOK = testVolumeGroup["VirtualIPAddr"]
   316  	if !virtualIPAddrOK || (0 != len(virtualIPAddr)) {
   317  		t.Fatalf("testConfMap missing VolumeGroup:VolumeD.VirtualIPAddr=")
   318  	}
   319  	primaryPeer, primaryPeerOK = testVolumeGroup["PrimaryPeer"]
   320  	if !primaryPeerOK || (1 != len(primaryPeer)) || ("Peer2" != primaryPeer[0]) {
   321  		t.Fatalf("testConfMap missing VolumeGroup:VolumeD.PrimaryPeer=Peer2")
   322  	}
   323  	readCacheLineSize, readCacheLineSizeOK = testVolumeGroup["ReadCacheLineSize"]
   324  	if !readCacheLineSizeOK || (1 != len(readCacheLineSize)) || ("2000000" != readCacheLineSize[0]) {
   325  		t.Fatalf("testConfMap missing VolumeGroup:VolumeD.ReadCacheLineSize=2000000")
   326  	}
   327  	readCacheWeight, readCacheWeightOK = testVolumeGroup["ReadCacheWeight"]
   328  	if !readCacheWeightOK || (1 != len(readCacheWeight)) || ("200" != readCacheWeight[0]) {
   329  		t.Fatalf("testConfMap missing VolumeGroup:VolumeD.ReadCacheWeight=200")
   330  	}
   331  
   332  	testVolume, testVolumeOK = testConfMap["Volume:VolumeD"]
   333  	if !testVolumeOK {
   334  		t.Fatalf("testConfMap must contain a Volume:VolumeD section")
   335  	}
   336  
   337  	maxFlushSize, maxFlushSizeOK = testVolume["MaxFlushSize"]
   338  	if !maxFlushSizeOK || (1 != len(maxFlushSize)) || ("20000000" != maxFlushSize[0]) {
   339  		t.Fatalf("testConfMap missing Volume:VolumeD.MaxFlushSize=20000000")
   340  	}
   341  	maxFlushTime, maxFlushTimeOK = testVolume["MaxFlushTime"]
   342  	if !maxFlushTimeOK || (1 != len(maxFlushTime)) || ("20s" != maxFlushTime[0]) {
   343  		t.Fatalf("testConfMap missing Volume:VolumeD.MaxFlushTime=20s")
   344  	}
   345  
   346  	fileDefragmentChunkSize, fileDefragmentChunkSizeOK = testVolume["FileDefragmentChunkSize"]
   347  	if !fileDefragmentChunkSizeOK || (1 != len(fileDefragmentChunkSize)) || ("20000000" != fileDefragmentChunkSize[0]) {
   348  		t.Fatalf("testConfigMap has invalid Volume:VolumeD.FileDefragmentChunkSize")
   349  	}
   350  	fileDefragmentChunkDelay, fileDefragmentChunkDelayOK = testVolume["FileDefragmentChunkDelay"]
   351  	if !fileDefragmentChunkDelayOK || (1 != len(fileDefragmentChunkDelay)) || ("20ms" != fileDefragmentChunkDelay[0]) {
   352  		t.Fatalf("testConfigMap has invalid Volume:VolumeD.FileDefragmentChunkDelay")
   353  	}
   354  }
   355  
   356  // testValidateCallbackLog compares the global testCallbackLog to the
   357  // provided expectedCallbackLog. Note that testCallbackLog is a time
   358  // ordered []string of log messages. It is expected that some have
   359  // order dependency (e.g. one cannot destroy a volume unless it has
   360  // been unserved if it was previously served by this peer). As such,
   361  // the structure of expectedCallbackLog is a time ordered list of
   362  // []string. Within each []string, order is not required...though each
   363  // element must match precisely once. In the slice of []string's, order
   364  // is strictly required.
   365  //
   366  func testValidateCallbackLog(t *testing.T, testcase string, expectedCallbackLog [][]string) {
   367  	var (
   368  		expectedCallbackLogSliceElement []string
   369  		numLogMessages                  int
   370  		testCallbackLogIndex            int
   371  		testCallbackLogSubset           []string
   372  		testCallbackLogSubsetElement    string
   373  		testCallbackLogSubsetIndex      int
   374  	)
   375  	// First ensure we have the expected number of log messages
   376  
   377  	numLogMessages = 0
   378  
   379  	for _, expectedCallbackLogSliceElement = range expectedCallbackLog {
   380  		numLogMessages += len(expectedCallbackLogSliceElement)
   381  	}
   382  
   383  	if len(testCallbackLog) != numLogMessages {
   384  		t.Fatalf("In testcase \"%s\", unexpected testCallbackLog", testcase)
   385  	}
   386  
   387  	testCallbackLogIndex = 0
   388  
   389  	for _, expectedCallbackLogSliceElement = range expectedCallbackLog {
   390  		testCallbackLogSubset = testCallbackLog[testCallbackLogIndex : testCallbackLogIndex+len(expectedCallbackLogSliceElement)]
   391  
   392  		sort.Strings(testCallbackLogSubset)
   393  		sort.Strings(expectedCallbackLogSliceElement)
   394  
   395  		for testCallbackLogSubsetIndex, testCallbackLogSubsetElement = range testCallbackLogSubset {
   396  			if testCallbackLogSubsetElement != expectedCallbackLogSliceElement[testCallbackLogSubsetIndex] {
   397  				t.Fatalf("In testcase \"%s\", unexpected testCallbackLog", testcase)
   398  			}
   399  		}
   400  
   401  		testCallbackLogIndex += len(testCallbackLogSubset)
   402  	}
   403  }
   404  
   405  func TestAPI(t *testing.T) {
   406  	var (
   407  		err                     error
   408  		testCallbacksInterface1 *testCallbacksInterfaceStruct
   409  		testCallbacksInterface2 *testCallbacksInterfaceStruct
   410  		testConfMap             conf.ConfMap
   411  	)
   412  
   413  	testCallbacksInterface1 = &testCallbacksInterfaceStruct{name: "1", t: t}
   414  	testCallbacksInterface2 = &testCallbacksInterfaceStruct{name: "2", t: t}
   415  
   416  	Register(testCallbacksInterface1.name, testCallbacksInterface1)
   417  	Register(testCallbacksInterface2.name, testCallbacksInterface2)
   418  
   419  	testConfMap, err = conf.MakeConfMapFromStrings(testConfStrings)
   420  	if nil != err {
   421  		t.Fatalf("conf.MakeConfMapFromStrings() failed: %v", err)
   422  	}
   423  
   424  	t.Log("Verify old->new conf.ConfMap conversion")
   425  
   426  	err = upgradeConfMapIfNeeded(testConfMap)
   427  	if nil != err {
   428  		t.Fatalf("upgradeConfMapIfNeeded(<old confMap contents) failed: %v", err)
   429  	}
   430  
   431  	testValidateUpgradedConfMap(t, testConfMap)
   432  
   433  	err = upgradeConfMapIfNeeded(testConfMap)
   434  	if nil != err {
   435  		t.Fatalf("upgradeConfMapIfNeeded(<new confMap contents) failed: %v", err)
   436  	}
   437  
   438  	testValidateUpgradedConfMap(t, testConfMap)
   439  
   440  	t.Log("Perform Up() sequence")
   441  
   442  	testCallbackLog = make([]string, 0, 24)
   443  
   444  	err = Up(testConfMap)
   445  	if nil != err {
   446  		t.Fatalf("Up() failed: %v", err)
   447  	}
   448  
   449  	testValidateCallbackLog(t,
   450  		"Perform Up() sequence",
   451  		[][]string{
   452  			[]string{
   453  				"testCallbacksInterface1.Up() called"},
   454  			[]string{
   455  				"testCallbacksInterface2.Up() called"},
   456  			[]string{
   457  				"testCallbacksInterface1.VolumeGroupCreated(,V_VolumeA_G,Peer0,) called",
   458  				"testCallbacksInterface1.VolumeGroupCreated(,V_VolumeB_G,Peer0,) called",
   459  				"testCallbacksInterface1.VolumeGroupCreated(,V_VolumeC_G,Peer1,) called",
   460  				"testCallbacksInterface1.VolumeGroupCreated(,V_VolumeD_G,Peer2,) called"},
   461  			[]string{
   462  				"testCallbacksInterface2.VolumeGroupCreated(,V_VolumeA_G,Peer0,) called",
   463  				"testCallbacksInterface2.VolumeGroupCreated(,V_VolumeB_G,Peer0,) called",
   464  				"testCallbacksInterface2.VolumeGroupCreated(,V_VolumeC_G,Peer1,) called",
   465  				"testCallbacksInterface2.VolumeGroupCreated(,V_VolumeD_G,Peer2,) called"},
   466  			[]string{
   467  				"testCallbacksInterface1.VolumeCreated(,VolumeA,V_VolumeA_G) called",
   468  				"testCallbacksInterface1.VolumeCreated(,VolumeB,V_VolumeB_G) called",
   469  				"testCallbacksInterface1.VolumeCreated(,VolumeC,V_VolumeC_G) called",
   470  				"testCallbacksInterface1.VolumeCreated(,VolumeD,V_VolumeD_G) called"},
   471  			[]string{
   472  				"testCallbacksInterface2.VolumeCreated(,VolumeA,V_VolumeA_G) called",
   473  				"testCallbacksInterface2.VolumeCreated(,VolumeB,V_VolumeB_G) called",
   474  				"testCallbacksInterface2.VolumeCreated(,VolumeC,V_VolumeC_G) called",
   475  				"testCallbacksInterface2.VolumeCreated(,VolumeD,V_VolumeD_G) called"},
   476  			[]string{
   477  				"testCallbacksInterface1.ServeVolume(,VolumeA) called",
   478  				"testCallbacksInterface1.ServeVolume(,VolumeB) called"},
   479  			[]string{
   480  				"testCallbacksInterface2.ServeVolume(,VolumeA) called",
   481  				"testCallbacksInterface2.ServeVolume(,VolumeB) called"},
   482  			[]string{
   483  				"testCallbacksInterface1.SignaledFinish() called"},
   484  			[]string{
   485  				"testCallbacksInterface2.SignaledFinish() called"},
   486  		})
   487  
   488  	t.Log("Perform Signaled() sequence with no changes")
   489  
   490  	testCallbackLog = make([]string, 0, 4)
   491  
   492  	err = Signaled(testConfMap)
   493  	if nil != err {
   494  		t.Fatalf("Signaled() failed: %v", err)
   495  	}
   496  
   497  	testValidateCallbackLog(t,
   498  		"Perform Signaled() sequence with no changes",
   499  		[][]string{
   500  			[]string{
   501  				"testCallbacksInterface2.SignaledStart() called"},
   502  			[]string{
   503  				"testCallbacksInterface1.SignaledStart() called"},
   504  			[]string{
   505  				"testCallbacksInterface1.SignaledFinish() called"},
   506  			[]string{
   507  				"testCallbacksInterface2.SignaledFinish() called"}})
   508  
   509  	t.Log("Move VolumeB from Peer0 to Peer1")
   510  
   511  	testConfMap["VolumeGroup:V_VolumeB_G"]["PrimaryPeer"] = []string{"Peer1"}
   512  
   513  	testCallbackLog = make([]string, 0, 8)
   514  
   515  	err = Signaled(testConfMap)
   516  	if nil != err {
   517  		t.Fatalf("Signaled() failed: %v", err)
   518  	}
   519  
   520  	testValidateCallbackLog(t,
   521  		"Move VolumeB from Peer0 to Peer1",
   522  		[][]string{
   523  			[]string{
   524  				"testCallbacksInterface2.VolumeToBeUnserved(,VolumeB) called"},
   525  			[]string{
   526  				"testCallbacksInterface1.VolumeToBeUnserved(,VolumeB) called"},
   527  			[]string{
   528  				"testCallbacksInterface2.SignaledStart() called"},
   529  			[]string{
   530  				"testCallbacksInterface1.SignaledStart() called"},
   531  			[]string{
   532  				"testCallbacksInterface2.UnserveVolume(,VolumeB) called"},
   533  			[]string{
   534  				"testCallbacksInterface1.UnserveVolume(,VolumeB) called"},
   535  			[]string{
   536  				"testCallbacksInterface1.VolumeGroupMoved(,V_VolumeB_G,Peer1,) called"},
   537  			[]string{
   538  				"testCallbacksInterface2.VolumeGroupMoved(,V_VolumeB_G,Peer1,) called"},
   539  			[]string{
   540  				"testCallbacksInterface1.SignaledFinish() called"},
   541  			[]string{
   542  				"testCallbacksInterface2.SignaledFinish() called"}})
   543  
   544  	t.Log("Move VolumeC from Peer1 to Peer2")
   545  
   546  	testConfMap["VolumeGroup:V_VolumeC_G"]["PrimaryPeer"] = []string{"Peer2"}
   547  
   548  	testCallbackLog = make([]string, 0, 6)
   549  
   550  	err = Signaled(testConfMap)
   551  	if nil != err {
   552  		t.Fatalf("Signaled() failed: %v", err)
   553  	}
   554  
   555  	testValidateCallbackLog(t,
   556  		"Move VolumeC from Peer1 to Peer2",
   557  		[][]string{
   558  			[]string{
   559  				"testCallbacksInterface2.SignaledStart() called"},
   560  			[]string{
   561  				"testCallbacksInterface1.SignaledStart() called"},
   562  			[]string{
   563  				"testCallbacksInterface1.VolumeGroupMoved(,V_VolumeC_G,Peer2,) called"},
   564  			[]string{
   565  				"testCallbacksInterface2.VolumeGroupMoved(,V_VolumeC_G,Peer2,) called"},
   566  			[]string{
   567  				"testCallbacksInterface1.SignaledFinish() called"},
   568  			[]string{
   569  				"testCallbacksInterface2.SignaledFinish() called"}})
   570  
   571  	t.Log("Destroy VolumeC")
   572  
   573  	testConfMap["FSGlobals"]["VolumeGroupList"] = []string{"V_VolumeA_G", "V_VolumeB_G", "V_VolumeD_G"}
   574  
   575  	delete(testConfMap, "VolumeGroup:V_VolumeC_G")
   576  	delete(testConfMap, "Volume:VolumeC")
   577  
   578  	testCallbackLog = make([]string, 0, 8)
   579  
   580  	err = Signaled(testConfMap)
   581  	if nil != err {
   582  		t.Fatalf("Signaled() failed: %v", err)
   583  	}
   584  
   585  	testValidateCallbackLog(t,
   586  		"Destroy VolumeC",
   587  		[][]string{
   588  			[]string{
   589  				"testCallbacksInterface2.SignaledStart() called"},
   590  			[]string{
   591  				"testCallbacksInterface1.SignaledStart() called"},
   592  			[]string{
   593  				"testCallbacksInterface2.VolumeDestroyed(,VolumeC) called"},
   594  			[]string{
   595  				"testCallbacksInterface1.VolumeDestroyed(,VolumeC) called"},
   596  			[]string{
   597  				"testCallbacksInterface2.VolumeGroupDestroyed(,V_VolumeC_G) called"},
   598  			[]string{
   599  				"testCallbacksInterface1.VolumeGroupDestroyed(,V_VolumeC_G) called"},
   600  			[]string{
   601  				"testCallbacksInterface1.SignaledFinish() called"},
   602  			[]string{
   603  				"testCallbacksInterface2.SignaledFinish() called"}})
   604  
   605  	t.Log("Move VolumeD from Peer2 to Peer0")
   606  
   607  	testConfMap["VolumeGroup:V_VolumeD_G"]["PrimaryPeer"] = []string{"Peer0"}
   608  
   609  	testCallbackLog = make([]string, 0, 8)
   610  
   611  	err = Signaled(testConfMap)
   612  	if nil != err {
   613  		t.Fatalf("Signaled() failed: %v", err)
   614  	}
   615  
   616  	testValidateCallbackLog(t,
   617  		"Move VolumeD from Peer2 to Peer0",
   618  		[][]string{
   619  			[]string{
   620  				"testCallbacksInterface2.SignaledStart() called"},
   621  			[]string{
   622  				"testCallbacksInterface1.SignaledStart() called"},
   623  			[]string{
   624  				"testCallbacksInterface1.VolumeGroupMoved(,V_VolumeD_G,Peer0,) called"},
   625  			[]string{
   626  				"testCallbacksInterface2.VolumeGroupMoved(,V_VolumeD_G,Peer0,) called"},
   627  			[]string{
   628  				"testCallbacksInterface1.ServeVolume(,VolumeD) called"},
   629  			[]string{
   630  				"testCallbacksInterface2.ServeVolume(,VolumeD) called"},
   631  			[]string{
   632  				"testCallbacksInterface1.SignaledFinish() called"},
   633  			[]string{
   634  				"testCallbacksInterface2.SignaledFinish() called"}})
   635  
   636  	t.Log("Destroy VolumeD")
   637  
   638  	testConfMap["FSGlobals"]["VolumeGroupList"] = []string{"V_VolumeA_G", "V_VolumeB_G"}
   639  
   640  	delete(testConfMap, "VolumeGroup:V_VolumeD_G")
   641  	delete(testConfMap, "Volume:VolumeD")
   642  
   643  	testCallbackLog = make([]string, 0, 10)
   644  
   645  	err = Signaled(testConfMap)
   646  	if nil != err {
   647  		t.Fatalf("Signaled() failed: %v", err)
   648  	}
   649  
   650  	testValidateCallbackLog(t,
   651  		"Destroy VolumeD",
   652  		[][]string{
   653  			[]string{
   654  				"testCallbacksInterface2.VolumeToBeUnserved(,VolumeD) called"},
   655  			[]string{
   656  				"testCallbacksInterface1.VolumeToBeUnserved(,VolumeD) called"},
   657  			[]string{
   658  				"testCallbacksInterface2.SignaledStart() called"},
   659  			[]string{
   660  				"testCallbacksInterface1.SignaledStart() called"},
   661  			[]string{
   662  				"testCallbacksInterface2.UnserveVolume(,VolumeD) called"},
   663  			[]string{
   664  				"testCallbacksInterface1.UnserveVolume(,VolumeD) called"},
   665  			[]string{
   666  				"testCallbacksInterface2.VolumeDestroyed(,VolumeD) called"},
   667  			[]string{
   668  				"testCallbacksInterface1.VolumeDestroyed(,VolumeD) called"},
   669  			[]string{
   670  				"testCallbacksInterface2.VolumeGroupDestroyed(,V_VolumeD_G) called"},
   671  			[]string{
   672  				"testCallbacksInterface1.VolumeGroupDestroyed(,V_VolumeD_G) called"},
   673  			[]string{
   674  				"testCallbacksInterface1.SignaledFinish() called"},
   675  			[]string{
   676  				"testCallbacksInterface2.SignaledFinish() called"}})
   677  
   678  	t.Log("Create VolumeE on Peer0")
   679  
   680  	err = testConfMap.UpdateFromStrings(testConfStringsToAddVolumeE)
   681  	if nil != err {
   682  		t.Fatalf("testConfMap.UpdateFromStrings(testConfStringsToAddVolumeE) failed: %v", err)
   683  	}
   684  
   685  	testCallbackLog = make([]string, 0, 10)
   686  
   687  	err = Signaled(testConfMap)
   688  	if nil != err {
   689  		t.Fatalf("Signaled() failed: %v", err)
   690  	}
   691  
   692  	testValidateCallbackLog(t,
   693  		"Create VolumeE on Peer0",
   694  		[][]string{
   695  			[]string{
   696  				"testCallbacksInterface2.SignaledStart() called"},
   697  			[]string{
   698  				"testCallbacksInterface1.SignaledStart() called"},
   699  			[]string{
   700  				"testCallbacksInterface1.VolumeGroupCreated(,VG_One,Peer0,) called"},
   701  			[]string{
   702  				"testCallbacksInterface2.VolumeGroupCreated(,VG_One,Peer0,) called"},
   703  			[]string{
   704  				"testCallbacksInterface1.VolumeCreated(,VolumeE,VG_One) called"},
   705  			[]string{
   706  				"testCallbacksInterface2.VolumeCreated(,VolumeE,VG_One) called"},
   707  			[]string{
   708  				"testCallbacksInterface1.ServeVolume(,VolumeE) called"},
   709  			[]string{
   710  				"testCallbacksInterface2.ServeVolume(,VolumeE) called"},
   711  			[]string{
   712  				"testCallbacksInterface1.SignaledFinish() called"},
   713  			[]string{
   714  				"testCallbacksInterface2.SignaledFinish() called"}})
   715  
   716  	t.Log("Create VolumeF on Peer1")
   717  
   718  	err = testConfMap.UpdateFromStrings(testConfStringsToAddVolumeF)
   719  	if nil != err {
   720  		t.Fatalf("testConfMap.UpdateFromStrings(testConfStringsToAddVolumeF) failed: %v", err)
   721  	}
   722  
   723  	testCallbackLog = make([]string, 0, 8)
   724  
   725  	err = Signaled(testConfMap)
   726  	if nil != err {
   727  		t.Fatalf("Signaled() failed: %v", err)
   728  	}
   729  
   730  	testValidateCallbackLog(t,
   731  		"Create VolumeF on Peer1",
   732  		[][]string{
   733  			[]string{
   734  				"testCallbacksInterface2.SignaledStart() called"},
   735  			[]string{
   736  				"testCallbacksInterface1.SignaledStart() called"},
   737  			[]string{
   738  				"testCallbacksInterface1.VolumeGroupCreated(,VG_Two,Peer1,) called"},
   739  			[]string{
   740  				"testCallbacksInterface2.VolumeGroupCreated(,VG_Two,Peer1,) called"},
   741  			[]string{
   742  				"testCallbacksInterface1.VolumeCreated(,VolumeF,VG_Two) called"},
   743  			[]string{
   744  				"testCallbacksInterface2.VolumeCreated(,VolumeF,VG_Two) called"},
   745  			[]string{
   746  				"testCallbacksInterface1.SignaledFinish() called"},
   747  			[]string{
   748  				"testCallbacksInterface2.SignaledFinish() called"}})
   749  
   750  	t.Log("Create VolumeG on Peer2")
   751  
   752  	err = testConfMap.UpdateFromStrings(testConfStringsToAddVolumeG)
   753  	if nil != err {
   754  		t.Fatalf("testConfMap.UpdateFromStrings(testConfStringsToAddVolumeG) failed: %v", err)
   755  	}
   756  
   757  	testCallbackLog = make([]string, 0, 8)
   758  
   759  	err = Signaled(testConfMap)
   760  	if nil != err {
   761  		t.Fatalf("Signaled() failed: %v", err)
   762  	}
   763  
   764  	testValidateCallbackLog(t,
   765  		"Create VolumeG on Peer2",
   766  		[][]string{
   767  			[]string{
   768  				"testCallbacksInterface2.SignaledStart() called"},
   769  			[]string{
   770  				"testCallbacksInterface1.SignaledStart() called"},
   771  			[]string{
   772  				"testCallbacksInterface1.VolumeGroupCreated(,VG_Three,Peer2,) called"},
   773  			[]string{
   774  				"testCallbacksInterface2.VolumeGroupCreated(,VG_Three,Peer2,) called"},
   775  			[]string{
   776  				"testCallbacksInterface1.VolumeCreated(,VolumeG,VG_Three) called"},
   777  			[]string{
   778  				"testCallbacksInterface2.VolumeCreated(,VolumeG,VG_Three) called"},
   779  			[]string{
   780  				"testCallbacksInterface1.SignaledFinish() called"},
   781  			[]string{
   782  				"testCallbacksInterface2.SignaledFinish() called"}})
   783  
   784  	t.Log("Move VolumeG to VolumeF's VolumeGroup")
   785  
   786  	err = testConfMap.UpdateFromStrings(testConfStringsToMoveVolumeG)
   787  	if nil != err {
   788  		t.Fatalf("testConfMap.UpdateFromStrings(testConfStringsToMoveVolumeG) failed: %v", err)
   789  	}
   790  
   791  	testCallbackLog = make([]string, 0, 6)
   792  
   793  	err = Signaled(testConfMap)
   794  	if nil != err {
   795  		t.Fatalf("Signaled() failed: %v", err)
   796  	}
   797  
   798  	testValidateCallbackLog(t,
   799  		"Move VolumeG to VolumeF's VolumeGroup",
   800  		[][]string{
   801  			[]string{
   802  				"testCallbacksInterface2.SignaledStart() called"},
   803  			[]string{
   804  				"testCallbacksInterface1.SignaledStart() called"},
   805  			[]string{
   806  				"testCallbacksInterface1.VolumeMoved(,VolumeG,VG_Two) called"},
   807  			[]string{
   808  				"testCallbacksInterface2.VolumeMoved(,VolumeG,VG_Two) called"},
   809  			[]string{
   810  				"testCallbacksInterface1.SignaledFinish() called"},
   811  			[]string{
   812  				"testCallbacksInterface2.SignaledFinish() called"}})
   813  
   814  	t.Log("Perform Down() sequence")
   815  
   816  	testCallbackLog = make([]string, 0, 28)
   817  
   818  	err = Down(testConfMap)
   819  	if nil != err {
   820  		t.Fatalf("Down() failed: %v", err)
   821  	}
   822  
   823  	testValidateCallbackLog(t,
   824  		"Perform Down() sequence",
   825  		[][]string{
   826  			[]string{
   827  				"testCallbacksInterface2.VolumeToBeUnserved(,VolumeA) called",
   828  				"testCallbacksInterface2.VolumeToBeUnserved(,VolumeE) called"},
   829  			[]string{
   830  				"testCallbacksInterface1.VolumeToBeUnserved(,VolumeA) called",
   831  				"testCallbacksInterface1.VolumeToBeUnserved(,VolumeE) called"},
   832  			[]string{
   833  				"testCallbacksInterface2.SignaledStart() called"},
   834  			[]string{
   835  				"testCallbacksInterface1.SignaledStart() called"},
   836  			[]string{
   837  				"testCallbacksInterface2.UnserveVolume(,VolumeA) called",
   838  				"testCallbacksInterface2.UnserveVolume(,VolumeE) called"},
   839  			[]string{
   840  				"testCallbacksInterface1.UnserveVolume(,VolumeA) called",
   841  				"testCallbacksInterface1.UnserveVolume(,VolumeE) called"},
   842  			[]string{
   843  				"testCallbacksInterface2.VolumeDestroyed(,VolumeA) called",
   844  				"testCallbacksInterface2.VolumeDestroyed(,VolumeB) called",
   845  				"testCallbacksInterface2.VolumeDestroyed(,VolumeE) called",
   846  				"testCallbacksInterface2.VolumeDestroyed(,VolumeF) called",
   847  				"testCallbacksInterface2.VolumeDestroyed(,VolumeG) called"},
   848  			[]string{
   849  				"testCallbacksInterface1.VolumeDestroyed(,VolumeA) called",
   850  				"testCallbacksInterface1.VolumeDestroyed(,VolumeB) called",
   851  				"testCallbacksInterface1.VolumeDestroyed(,VolumeE) called",
   852  				"testCallbacksInterface1.VolumeDestroyed(,VolumeF) called",
   853  				"testCallbacksInterface1.VolumeDestroyed(,VolumeG) called"},
   854  			[]string{
   855  				"testCallbacksInterface2.VolumeGroupDestroyed(,V_VolumeA_G) called",
   856  				"testCallbacksInterface2.VolumeGroupDestroyed(,V_VolumeB_G) called",
   857  				"testCallbacksInterface2.VolumeGroupDestroyed(,VG_One) called",
   858  				"testCallbacksInterface2.VolumeGroupDestroyed(,VG_Two) called",
   859  				"testCallbacksInterface2.VolumeGroupDestroyed(,VG_Three) called"},
   860  			[]string{
   861  				"testCallbacksInterface1.VolumeGroupDestroyed(,V_VolumeA_G) called",
   862  				"testCallbacksInterface1.VolumeGroupDestroyed(,V_VolumeB_G) called",
   863  				"testCallbacksInterface1.VolumeGroupDestroyed(,VG_One) called",
   864  				"testCallbacksInterface1.VolumeGroupDestroyed(,VG_Two) called",
   865  				"testCallbacksInterface1.VolumeGroupDestroyed(,VG_Three) called"},
   866  			[]string{
   867  				"testCallbacksInterface2.Down() called"},
   868  			[]string{
   869  				"testCallbacksInterface1.Down() called"}})
   870  }
   871  
   872  func (testCallbacksInterface *testCallbacksInterfaceStruct) Up(confMap conf.ConfMap) (err error) {
   873  	logMessage := fmt.Sprintf("testCallbacksInterface%s.Up() called", testCallbacksInterface.name)
   874  	testCallbacksInterface.t.Logf("  %s", logMessage)
   875  	testCallbackLog = append(testCallbackLog, logMessage)
   876  	return nil
   877  }
   878  
   879  func (testCallbacksInterface *testCallbacksInterfaceStruct) VolumeGroupCreated(confMap conf.ConfMap, volumeGroupName string, activePeer string, virtualIPAddr string) (err error) {
   880  	logMessage := fmt.Sprintf("testCallbacksInterface%s.VolumeGroupCreated(,%s,%s,%s) called", testCallbacksInterface.name, volumeGroupName, activePeer, virtualIPAddr)
   881  	testCallbacksInterface.t.Logf("  %s", logMessage)
   882  	testCallbackLog = append(testCallbackLog, logMessage)
   883  	return nil
   884  }
   885  
   886  func (testCallbacksInterface *testCallbacksInterfaceStruct) VolumeGroupMoved(confMap conf.ConfMap, volumeGroupName string, activePeer string, virtualIPAddr string) (err error) {
   887  	logMessage := fmt.Sprintf("testCallbacksInterface%s.VolumeGroupMoved(,%s,%s,%s) called", testCallbacksInterface.name, volumeGroupName, activePeer, virtualIPAddr)
   888  	testCallbacksInterface.t.Logf("  %s", logMessage)
   889  	testCallbackLog = append(testCallbackLog, logMessage)
   890  	return nil
   891  }
   892  
   893  func (testCallbacksInterface *testCallbacksInterfaceStruct) VolumeGroupDestroyed(confMap conf.ConfMap, volumeGroupName string) (err error) {
   894  	logMessage := fmt.Sprintf("testCallbacksInterface%s.VolumeGroupDestroyed(,%s) called", testCallbacksInterface.name, volumeGroupName)
   895  	testCallbacksInterface.t.Logf("  %s", logMessage)
   896  	testCallbackLog = append(testCallbackLog, logMessage)
   897  	return nil
   898  }
   899  
   900  func (testCallbacksInterface *testCallbacksInterfaceStruct) VolumeCreated(confMap conf.ConfMap, volumeName string, volumeGroupName string) (err error) {
   901  	logMessage := fmt.Sprintf("testCallbacksInterface%s.VolumeCreated(,%s,%s) called", testCallbacksInterface.name, volumeName, volumeGroupName)
   902  	testCallbacksInterface.t.Logf("  %s", logMessage)
   903  	testCallbackLog = append(testCallbackLog, logMessage)
   904  	return nil
   905  }
   906  
   907  func (testCallbacksInterface *testCallbacksInterfaceStruct) VolumeMoved(confMap conf.ConfMap, volumeName string, volumeGroupName string) (err error) {
   908  	logMessage := fmt.Sprintf("testCallbacksInterface%s.VolumeMoved(,%s,%s) called", testCallbacksInterface.name, volumeName, volumeGroupName)
   909  	testCallbacksInterface.t.Logf("  %s", logMessage)
   910  	testCallbackLog = append(testCallbackLog, logMessage)
   911  	return nil
   912  }
   913  
   914  func (testCallbacksInterface *testCallbacksInterfaceStruct) VolumeDestroyed(confMap conf.ConfMap, volumeName string) (err error) {
   915  	logMessage := fmt.Sprintf("testCallbacksInterface%s.VolumeDestroyed(,%s) called", testCallbacksInterface.name, volumeName)
   916  	testCallbacksInterface.t.Logf("  %s", logMessage)
   917  	testCallbackLog = append(testCallbackLog, logMessage)
   918  	return nil
   919  }
   920  
   921  func (testCallbacksInterface *testCallbacksInterfaceStruct) ServeVolume(confMap conf.ConfMap, volumeName string) (err error) {
   922  	logMessage := fmt.Sprintf("testCallbacksInterface%s.ServeVolume(,%s) called", testCallbacksInterface.name, volumeName)
   923  	testCallbacksInterface.t.Logf("  %s", logMessage)
   924  	testCallbackLog = append(testCallbackLog, logMessage)
   925  	return nil
   926  }
   927  
   928  func (testCallbacksInterface *testCallbacksInterfaceStruct) UnserveVolume(confMap conf.ConfMap, volumeName string) (err error) {
   929  	logMessage := fmt.Sprintf("testCallbacksInterface%s.UnserveVolume(,%s) called", testCallbacksInterface.name, volumeName)
   930  	testCallbacksInterface.t.Logf("  %s", logMessage)
   931  	testCallbackLog = append(testCallbackLog, logMessage)
   932  	return nil
   933  }
   934  
   935  func (testCallbacksInterface *testCallbacksInterfaceStruct) VolumeToBeUnserved(confMap conf.ConfMap, volumeName string) (err error) {
   936  	logMessage := fmt.Sprintf("testCallbacksInterface%s.VolumeToBeUnserved(,%s) called", testCallbacksInterface.name, volumeName)
   937  	testCallbacksInterface.t.Logf("  %s", logMessage)
   938  	testCallbackLog = append(testCallbackLog, logMessage)
   939  	return nil
   940  }
   941  
   942  func (testCallbacksInterface *testCallbacksInterfaceStruct) SignaledStart(confMap conf.ConfMap) (err error) {
   943  	logMessage := fmt.Sprintf("testCallbacksInterface%s.SignaledStart() called", testCallbacksInterface.name)
   944  	testCallbacksInterface.t.Logf("  %s", logMessage)
   945  	testCallbackLog = append(testCallbackLog, logMessage)
   946  	return nil
   947  }
   948  
   949  func (testCallbacksInterface *testCallbacksInterfaceStruct) SignaledFinish(confMap conf.ConfMap) (err error) {
   950  	logMessage := fmt.Sprintf("testCallbacksInterface%s.SignaledFinish() called", testCallbacksInterface.name)
   951  	testCallbacksInterface.t.Logf("  %s", logMessage)
   952  	testCallbackLog = append(testCallbackLog, logMessage)
   953  	return nil
   954  }
   955  
   956  func (testCallbacksInterface *testCallbacksInterfaceStruct) Down(confMap conf.ConfMap) (err error) {
   957  	logMessage := fmt.Sprintf("testCallbacksInterface%s.Down() called", testCallbacksInterface.name)
   958  	testCallbacksInterface.t.Logf("  %s", logMessage)
   959  	testCallbackLog = append(testCallbackLog, logMessage)
   960  	return nil
   961  }