Skip to content

Commit

Permalink
Improve integration testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sapk committed Nov 26, 2018
1 parent 462d818 commit c946c35
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions gluster/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ func TestIntegration(t *testing.T) {
if err != nil {
t.Errorf("Failed to write inside mounted volume : %v", err)
}
out, err = cmd("docker", "run", "--rm", "-t", "-v", "replica:/mnt", "alpine", "/bin/cat", "/mnt/container")
log.Println(out)
outReplicaContainer, err := cmd("docker", "run", "--rm", "-t", "-v", "replica:/mnt", "alpine", "/bin/cat", "/mnt/container")
log.Println(outReplicaContainer)
if err != nil {
t.Errorf("Failed to read from mounted volume : %v", err)
}
Expand All @@ -173,8 +173,8 @@ func TestIntegration(t *testing.T) {
if err != nil {
t.Errorf("Failed to write inside mounted volume : %v", err)
}
out, err = cmd("docker", "run", "--rm", "-t", "-v", "distributed:/mnt", "alpine", "/bin/cat", "/mnt/container")
log.Println(out)
outDistributedContainer, err := cmd("docker", "run", "--rm", "-t", "-v", "distributed:/mnt", "alpine", "/bin/cat", "/mnt/container")
log.Println(outDistributedContainer)
if err != nil {
t.Errorf("Failed to read from mounted volume : %v", err)
}
Expand All @@ -190,6 +190,10 @@ func TestIntegration(t *testing.T) {
if err != nil {
t.Errorf("Failed to read from mounted volume (with fallback) : %v", err)
}
if outReplicaContainer != out {
t.Errorf("Content inside gluster replica volume in not the same : %s != %s", outReplicaContainer, out)
}

out, err = cmd("docker", "run", "--rm", "-t", "-v", "distributed-double-server:/mnt", "alpine", "/bin/ls", "/mnt")
log.Println(out)
if err != nil {
Expand All @@ -200,6 +204,9 @@ func TestIntegration(t *testing.T) {
if err != nil {
t.Errorf("Failed to read from mounted volume (with fallback) : %v", err)
}
if outDistributedContainer != out {
t.Errorf("Content inside gluster distributed volume in not the same : %s != %s", outDistributedContainer, out)
}
//TODO check that container is same as before

}

0 comments on commit c946c35

Please sign in to comment.