Skip to content

Commit

Permalink
Using shot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sapk committed Mar 27, 2018
1 parent 316d303 commit f72a897
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions gluster/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ func TestMain(m *testing.M) {

randomTestName = strconv.Itoa(rand.Int())

//Setup managed plugin
setupManagedPlugin()
//Clean up
defer cleanManagedPlugin()

//Setup cluster
setupGlusterCluster()
//Clean up
Expand Down Expand Up @@ -160,6 +155,14 @@ func TestIntegration(t *testing.T) {
//Startplugin with empty config
go setupPlugin()
time.Sleep(3 * timeInterval)

if !testing.Short() {
//Setup managed plugin
setupManagedPlugin()
//Clean up
defer cleanManagedPlugin()
}

IPs := getGlusterClusterContainersIPs()

testCases := []struct {
Expand All @@ -184,6 +187,24 @@ func TestIntegration(t *testing.T) {
{strconv.Itoa(rand.Int()), "managed-distributed-subdir", gluster.PluginAlias, "test-distributed/subdir", IPs[:1], ""},
}

if testing.Short() { //Disable managed volume
testCases = []struct {
id string
name string
driver string
volume string
servers []string
hostname string
}{
{strconv.Itoa(rand.Int()), "replica", gluster.PluginAlias, "test-replica", IPs[:1], ""},
{strconv.Itoa(rand.Int()), "distributed", gluster.PluginAlias, "test-distributed", IPs[:1], ""},
{strconv.Itoa(rand.Int()), "replica-double-server", gluster.PluginAlias, "test-replica", IPs[:2], ""},
{strconv.Itoa(rand.Int()), "distributed-double-server", gluster.PluginAlias, "test-distributed", IPs[:2], ""},
{strconv.Itoa(rand.Int()), "replica-subdir", gluster.PluginAlias, "test-replica/subdir", IPs[:1], ""},
{strconv.Itoa(rand.Int()), "distributed-subdir", gluster.PluginAlias, "test-distributed/subdir", IPs[:1], ""},
}
}

for _, tc := range testCases {
t.Run("Create volume for "+tc.name, func(t *testing.T) {
logrus.Print(cmd("docker", os.Environ(), "volume", "create", "--driver", tc.driver, "--opt", "voluri=\""+strings.Join(tc.servers, ",")+":"+tc.volume+"\"", tc.id))
Expand Down

0 comments on commit f72a897

Please sign in to comment.