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() {
|
|
|
|
|
|
|
|
Context("goofys", func() {
|
|
|
|
socket := "/tmp/csi-goofys.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() + "/goofys-target",
|
|
|
|
StagingPath: os.TempDir() + "/goofys-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{
|
|
|
|
"mounter": "goofys",
|
|
|
|
"bucket": "testbucket0",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
sanity.GinkgoTest(sanityCfg)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
Context("goofys-no-bucket", func() {
|
|
|
|
socket := "/tmp/csi-goofys-no-bucket.sock"
|
|
|
|
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{
|
|
|
|
TargetPath: os.TempDir() + "/goofys-no-bucket-target",
|
|
|
|
StagingPath: os.TempDir() + "/goofys-no-bucket-staging",
|
|
|
|
Address: csiEndpoint,
|
|
|
|
SecretsFile: "../../test/secret.yaml",
|
2019-03-10 11:19:02 +00:00
|
|
|
TestVolumeParameters: map[string]string{
|
|
|
|
"mounter": "goofys",
|
|
|
|
},
|
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)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2018-07-22 20:08:48 +00:00
|
|
|
Context("s3backer", func() {
|
|
|
|
socket := "/tmp/csi-s3backer.sock"
|
|
|
|
csiEndpoint := "unix://" + socket
|
|
|
|
|
|
|
|
if err := os.Remove(socket); err != nil && !os.IsNotExist(err) {
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
}
|
2018-08-03 18:30:46 +00:00
|
|
|
// Clear loop device so we cover the creation of it
|
2021-04-03 10:40:58 +00:00
|
|
|
os.Remove(mounter.S3backerLoopDevice)
|
|
|
|
driver, err := driver.New("test-node", csiEndpoint)
|
2018-07-22 20:08:48 +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() + "/s3backer-target",
|
|
|
|
StagingPath: os.TempDir() + "/s3backer-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": "s3backer",
|
2021-04-05 13:07:16 +00:00
|
|
|
"bucket": "testbucket2",
|
2019-03-10 11:19:02 +00:00
|
|
|
},
|
2018-07-22 20:08:48 +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
|
|
|
})
|