api: Do not use sqs for ListenBucketNotification. (#3023)

Add more tests. Fixes #3024
This commit is contained in:
Harshavardhana
2016-10-21 01:25:17 -07:00
committed by GitHub
parent d3aaf50a40
commit ece559afe2
15 changed files with 127 additions and 534 deletions
-50
View File
@@ -20,7 +20,6 @@ import (
"flag"
"net/http"
"os"
"path/filepath"
"runtime"
"testing"
@@ -186,55 +185,6 @@ func TestCheckServerSyntax(t *testing.T) {
}
}
func TestGetPort(t *testing.T) {
root, err := newTestConfig("us-east-1")
if err != nil {
t.Fatal("failed to create test config")
}
defer removeAll(root)
testCases := []struct {
addr string
ssl bool
expectedPort int
}{
{"localhost:1234", true, 1234},
{"localhost:1234", false, 1234},
{"localhost", true, 443},
{"localhost", false, 80},
}
certFile := filepath.Join(mustGetCertsPath(), globalMinioCertFile)
keyFile := filepath.Join(mustGetCertsPath(), globalMinioKeyFile)
err = os.MkdirAll(filepath.Dir(certFile), 0755)
if err != nil {
t.Fatalf("Couldn't create certs directory.")
}
for i, test := range testCases {
if test.ssl {
cFile, cErr := os.Create(certFile)
if cErr != nil {
t.Fatalf("Failed to create cert file %s", certFile)
}
cFile.Close()
tFile, tErr := os.Create(keyFile)
if tErr != nil {
t.Fatalf("Failed to create key file %s", keyFile)
}
tFile.Close()
}
port := getPort(test.addr)
if port != test.expectedPort {
t.Errorf("Test %d expected port %d but received %d", i+1, test.expectedPort, port)
}
if test.ssl {
os.Remove(certFile)
os.Remove(keyFile)
}
}
}
func TestIsDistributedSetup(t *testing.T) {
var testCases []struct {
disks []string