2021-04-03 10:40:58 +00:00
|
|
|
package driver_test
|
2018-07-19 20:04:36 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
|
2021-04-03 10:40:58 +00:00
|
|
|
"github.com/ctrox/csi-s3/pkg/driver"
|
|
|
|
"github.com/ctrox/csi-s3/pkg/mounter"
|
2018-07-19 20:04:36 +00:00
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
|
|
|
|
"github.com/kubernetes-csi/csi-test/pkg/sanity"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("S3Driver", func() {
|
|
|
|
|
2021-07-26 11:51:19 +00:00
|
|
|
Context("geesefs", func() {
|
|
|
|
socket := "/tmp/csi-geesefs.sock"
|
2018-07-19 20:04:36 +00:00
|
|
|
csiEndpoint := "unix://" + socket
|
|
|
|
if err := os.Remove(socket); err != nil && !os.IsNotExist(err) {
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
}
|
2021-04-03 10:40:58 +00:00
|
|
|
driver, err := driver.New("test-node", csiEndpoint)
|
2018-07-19 20:04:36 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
go driver.Run()
|
|
|
|
|
|
|
|
Describe("CSI sanity", func() {
|
|
|
|
sanityCfg := &sanity.Config{
|
2021-07-26 11:51:19 +00:00
|
|
|
TargetPath: os.TempDir() + "/geesefs-target",
|
|
|
|
StagingPath: os.TempDir() + "/geesefs-staging",
|
2018-07-27 10:56:28 +00:00
|
|
|
Address: csiEndpoint,
|
2019-03-10 11:19:02 +00:00
|
|
|
SecretsFile: "../../test/secret.yaml",
|
2021-04-05 13:07:16 +00:00
|
|
|
TestVolumeParameters: map[string]string{
|
2021-07-26 11:51:19 +00:00
|
|
|
"mounter": "geesefs",
|
2021-04-05 13:07:16 +00:00
|
|
|
"bucket": "testbucket0",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
sanity.GinkgoTest(sanityCfg)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-07-26 11:51:19 +00:00
|
|
|
Context("geesefs-no-bucket", func() {
|
|
|
|
socket := "/tmp/csi-geesefs-no-bucket.sock"
|
2021-04-05 13:07:16 +00:00
|
|
|
csiEndpoint := "unix://" + socket
|
|
|
|
if err := os.Remove(socket); err != nil && !os.IsNotExist(err) {
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
}
|
|
|
|
driver, err := driver.New("test-node", csiEndpoint)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
go driver.Run()
|
|
|
|
|
|
|
|
Describe("CSI sanity", func() {
|
|
|
|
sanityCfg := &sanity.Config{
|
2021-07-26 11:51:19 +00:00
|
|
|
TargetPath: os.TempDir() + "/geesefs-no-bucket-target",
|
|
|
|
StagingPath: os.TempDir() + "/geesefs-no-bucket-staging",
|
2021-04-05 13:07:16 +00:00
|
|
|
Address: csiEndpoint,
|
|
|
|
SecretsFile: "../../test/secret.yaml",
|
2019-03-10 11:19:02 +00:00
|
|
|
TestVolumeParameters: map[string]string{
|
2021-07-26 11:51:19 +00:00
|
|
|
"mounter": "geesefs",
|
2019-03-10 11:19:02 +00:00
|
|
|
},
|
2018-07-19 20:04:36 +00:00
|
|
|
}
|
|
|
|
sanity.GinkgoTest(sanityCfg)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
Context("s3fs", func() {
|
|
|
|
socket := "/tmp/csi-s3fs.sock"
|
|
|
|
csiEndpoint := "unix://" + socket
|
|
|
|
if err := os.Remove(socket); err != nil && !os.IsNotExist(err) {
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
}
|
2021-04-03 10:40:58 +00:00
|
|
|
driver, err := driver.New("test-node", csiEndpoint)
|
2018-07-19 20:04:36 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
go driver.Run()
|
|
|
|
|
|
|
|
Describe("CSI sanity", func() {
|
|
|
|
sanityCfg := &sanity.Config{
|
2019-05-14 19:01:54 +00:00
|
|
|
TargetPath: os.TempDir() + "/s3fs-target",
|
|
|
|
StagingPath: os.TempDir() + "/s3fs-staging",
|
2018-07-27 10:56:28 +00:00
|
|
|
Address: csiEndpoint,
|
2019-03-10 11:19:02 +00:00
|
|
|
SecretsFile: "../../test/secret.yaml",
|
|
|
|
TestVolumeParameters: map[string]string{
|
|
|
|
"mounter": "s3fs",
|
2021-04-05 13:07:16 +00:00
|
|
|
"bucket": "testbucket1",
|
2019-03-10 11:19:02 +00:00
|
|
|
},
|
2018-07-19 20:04:36 +00:00
|
|
|
}
|
|
|
|
sanity.GinkgoTest(sanityCfg)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2019-03-07 19:27:02 +00:00
|
|
|
Context("rclone", func() {
|
|
|
|
socket := "/tmp/csi-rclone.sock"
|
|
|
|
csiEndpoint := "unix://" + socket
|
|
|
|
|
|
|
|
if err := os.Remove(socket); err != nil && !os.IsNotExist(err) {
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
}
|
2021-04-03 10:40:58 +00:00
|
|
|
driver, err := driver.New("test-node", csiEndpoint)
|
2019-03-07 19:27:02 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
go driver.Run()
|
|
|
|
|
|
|
|
Describe("CSI sanity", func() {
|
|
|
|
sanityCfg := &sanity.Config{
|
2019-05-14 19:01:54 +00:00
|
|
|
TargetPath: os.TempDir() + "/rclone-target",
|
|
|
|
StagingPath: os.TempDir() + "/rclone-staging",
|
2019-03-07 19:27:02 +00:00
|
|
|
Address: csiEndpoint,
|
2019-03-10 11:19:02 +00:00
|
|
|
SecretsFile: "../../test/secret.yaml",
|
|
|
|
TestVolumeParameters: map[string]string{
|
|
|
|
"mounter": "rclone",
|
2021-04-05 13:07:16 +00:00
|
|
|
"bucket": "testbucket3",
|
2019-03-10 11:19:02 +00:00
|
|
|
},
|
2019-03-07 19:27:02 +00:00
|
|
|
}
|
|
|
|
sanity.GinkgoTest(sanityCfg)
|
|
|
|
})
|
|
|
|
})
|
2018-07-19 20:04:36 +00:00
|
|
|
})
|