| 
 | 1 | +/*  | 
 | 2 | +Copyright 2019 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 sidecar_controller  | 
 | 18 | + | 
 | 19 | +import (  | 
 | 20 | +	"testing"  | 
 | 21 | +	"time"  | 
 | 22 | +)  | 
 | 23 | + | 
 | 24 | +func TestSyncContent(t *testing.T) {  | 
 | 25 | +	var tests []controllerTest  | 
 | 26 | + | 
 | 27 | +	tests = append(tests, controllerTest{  | 
 | 28 | +		name:             "Basic content create ready to use",  | 
 | 29 | +		initialContents:  newContentArrayWithReadyToUse("content1-1", "snapuid1-1", "snap1-1", "sid1-1", defaultClass, "", "", retainPolicy, nil, &defaultSize, &False, true),  | 
 | 30 | +		expectedContents: newContentArrayWithReadyToUse("content1-1", "snapuid1-1", "snap1-1", "sid1-1", defaultClass, "", "", retainPolicy, nil, &defaultSize, &True, true),  | 
 | 31 | +		expectedEvents:   noevents,  | 
 | 32 | +		expectedCreateCalls: []createCall{  | 
 | 33 | +			{  | 
 | 34 | +				snapshotName: "snapshot-snapuid1-1",  | 
 | 35 | +				driverName:   mockDriverName,  | 
 | 36 | +				snapshotId:   "snapuid1-1",  | 
 | 37 | +				creationTime: timeNow,  | 
 | 38 | +				readyToUse:   true,  | 
 | 39 | +			},  | 
 | 40 | +		},  | 
 | 41 | +		expectedListCalls: []listCall{{"sid1-1", true, time.Now(), 1, nil}},  | 
 | 42 | +		errors:            noerrors,  | 
 | 43 | +		test:              testSyncContent,  | 
 | 44 | +	})  | 
 | 45 | + | 
 | 46 | +	runSyncContentTests(t, tests, snapshotClasses)  | 
 | 47 | +}  | 
0 commit comments