-
Notifications
You must be signed in to change notification settings - Fork 808
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cheng Pan
committed
Feb 29, 2020
1 parent
fd1054e
commit d723c23
Showing
7 changed files
with
332 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package driver | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/kubernetes-csi/csi-test/pkg/sanity" | ||
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud" | ||
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/internal" | ||
) | ||
|
||
func TestSanity(t *testing.T) { | ||
// Setup the full driver and its environment | ||
dir, err := ioutil.TempDir("", "sanity-ebs-csi") | ||
if err != nil { | ||
t.Fatalf("error creating directory %v", err) | ||
} | ||
defer os.RemoveAll(dir) | ||
|
||
targetPath := filepath.Join(dir, "target") | ||
stagingPath := filepath.Join(dir, "staging") | ||
endpoint := "unix://" + filepath.Join(dir, "csi.sock") | ||
|
||
config := &sanity.Config{ | ||
TargetPath: targetPath, | ||
StagingPath: stagingPath, | ||
Address: endpoint, | ||
} | ||
|
||
driverOptions := &DriverOptions{ | ||
endpoint: endpoint, | ||
mode: AllMode, | ||
} | ||
|
||
drv := &Driver{ | ||
options: driverOptions, | ||
controllerService: controllerService{ | ||
cloud: newFakeCloudProvider(), | ||
driverOptions: driverOptions, | ||
}, | ||
nodeService: nodeService{ | ||
metadata: &cloud.Metadata{ | ||
InstanceID: "instanceID", | ||
Region: "region", | ||
AvailabilityZone: "az", | ||
}, | ||
mounter: newFakeMounter(), | ||
inFlight: internal.NewInFlight(), | ||
}, | ||
} | ||
defer func() { | ||
if r := recover(); r != nil { | ||
t.Fatalf("recover: %v", r) | ||
} | ||
}() | ||
go func() { | ||
if err := drv.Run(); err != nil { | ||
panic(fmt.Sprintf("%v", err)) | ||
} | ||
}() | ||
|
||
// Now call the test suite | ||
sanity.Test(t, config) | ||
} |
Oops, something went wrong.