Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#8 from leakingtapan/ginkgo-test-sa…
Browse files Browse the repository at this point in the history
…nity

Update santiy test to use ginkgo.
  • Loading branch information
jsafrane authored Sep 26, 2018
2 parents 6ffb27d + 9d73de4 commit 43efd7c
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions tests/sanity/sanity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,52 @@ import (
"os"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/bertinatto/ebs-csi-driver/pkg/cloud"
"github.com/bertinatto/ebs-csi-driver/pkg/driver"
sanity "github.com/kubernetes-csi/csi-test/pkg/sanity"
)

func TestSanity(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "AWS EBS CSI Driver Sanity Tests")
}

var _ = Describe("AWS EBS CSI Driver", func() {
const (
mountPath = "/tmp/csi/mount"
stagePath = "/tmp/csi/stage"
socket = "/tmp/csi.sock"
endpoint = "unix://" + socket
)

if err := os.Remove(socket); err != nil && !os.IsNotExist(err) {
t.Fatalf("could not remove socket file %s: %v", socket, err)
}

ebsDriver := driver.NewDriver(cloud.NewFakeCloudProvider(), driver.NewFakeMounter(), endpoint)
defer ebsDriver.Stop()

go func() {
if err := ebsDriver.Run(); err != nil {
t.Fatalf("could not run CSI driver: %v", err)
}
}()

config := &sanity.Config{
Address: endpoint,
TargetPath: mountPath,
StagingPath: stagePath,
}

sanity.Test(t, config)
}
var ebsDriver *driver.Driver

BeforeEach(func() {
ebsDriver = driver.NewDriver(cloud.NewFakeCloudProvider(), driver.NewFakeMounter(), endpoint)
go func() {
err := ebsDriver.Run()
Expect(err).To(BeNil())
}()
})

AfterEach(func() {
ebsDriver.Stop()
if err := os.Remove(socket); err != nil && !os.IsNotExist(err) {
Expect(err).To(BeNil())
}
})

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

})

0 comments on commit 43efd7c

Please sign in to comment.