Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/sanity: support sanity testing in another Ginkgo suite #90

Merged
merged 2 commits into from
Jul 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions pkg/sanity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,50 @@ Golang `TestXXX` functions. For example:

```go
func TestMyDriver(t *testing.T) {
// Setup the full driver and its environment
... setup driver ...
// Setup the full driver and its environment
... setup driver ...
config := &sanity.Config{
TargetPath: ...
StagingPath: ...
Address: endpoint,
}

// Now call the test suite
sanity.Test(t, driverEndpointAddress, "/mnt")

// Now call the test suite
sanity.Test(t, config)
}
```

Only one such test function is supported because under the hood a
Ginkgo test suite gets constructed and executed by the call.

Alternatively, the tests can also be embedded inside a Ginkgo test
suite. In that case it is possible to define multiple tests with
different configurations:

```go
var _ = Describe("MyCSIDriver", func () {
Context("Config A", func () {
var config &sanity.Config

BeforeEach() {
... setup driver and config...
}

AfterEach() {
...tear down driver...
}

Describe("CSI sanity", func() {
sanity.GinkgoTest(config)
})
})

Context("Config B", func () {
...
})
})
```

## Command line program
Please see [csi-sanity](https://github.com/kubernetes-csi/csi-test/tree/master/cmd/csi-sanity)
Loading