disable s3 test if the endpoint is not available
"crypto/sha1"
"fmt"
"log"
+ "net"
"os"
"testing"
"time"
@@ -38,11 +39,25 @@ func getBucketName() string {
return fmt.Sprintf("kopia-test-%x", h.Sum(nil)[0:8])
}
+func endpointReachable() bool {
+ conn, err := net.DialTimeout("tcp4", endpoint, 5*time.Second)
+ if err == nil {
+ conn.Close()
+ return true
+ }
+
+ return false
+}
+
func TestS3Storage(t *testing.T) {
if testing.Short() {
return
}
+ if !endpointReachable() {
+ return
+ }
+
ctx := context.Background()
// recreate per-host bucket, which sometimes get cleaned up by play.minio.io
