Skip to content

Commit

Permalink
Merge pull request #191 from ggriffiths/new_beta_split_controller_uni…
Browse files Browse the repository at this point in the history
…ttests

Add sidecar-controller unit tests
  • Loading branch information
k8s-ci-robot authored Nov 9, 2019
2 parents fa239cb + e4e2f3b commit 105b84d
Show file tree
Hide file tree
Showing 5 changed files with 1,549 additions and 0 deletions.
47 changes: 47 additions & 0 deletions pkg/sidecar-controller/content_create_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package sidecar_controller

import (
"testing"
"time"
)

func TestSyncContent(t *testing.T) {
var tests []controllerTest

tests = append(tests, controllerTest{
name: "Basic content create ready to use",
initialContents: newContentArrayWithReadyToUse("content1-1", "snapuid1-1", "snap1-1", "sid1-1", defaultClass, "", "", retainPolicy, nil, &defaultSize, &False, true),
expectedContents: newContentArrayWithReadyToUse("content1-1", "snapuid1-1", "snap1-1", "sid1-1", defaultClass, "", "", retainPolicy, nil, &defaultSize, &True, true),
expectedEvents: noevents,
expectedCreateCalls: []createCall{
{
snapshotName: "snapshot-snapuid1-1",
driverName: mockDriverName,
snapshotId: "snapuid1-1",
creationTime: timeNow,
readyToUse: true,
},
},
expectedListCalls: []listCall{{"sid1-1", true, time.Now(), 1, nil}},
errors: noerrors,
test: testSyncContent,
})

runSyncContentTests(t, tests, snapshotClasses)
}
Loading

0 comments on commit 105b84d

Please sign in to comment.