Skip to content

Commit 105b84d

Browse files
authored
Merge pull request #191 from ggriffiths/new_beta_split_controller_unittests
Add sidecar-controller unit tests
2 parents fa239cb + e4e2f3b commit 105b84d

File tree

5 files changed

+1549
-0
lines changed

5 files changed

+1549
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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

Comments
 (0)