Skip to content

Commit

Permalink
fix unit test is failed on the windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mei-rune committed Apr 3, 2015
1 parent f787755 commit e129c53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions messaging/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"os"
"path/filepath"
"reflect"
"strings"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -393,7 +392,7 @@ func TestReadSegments_ENOENT(t *testing.T) {
os.RemoveAll(path)

_, err := messaging.ReadSegments(path)
if err == nil || !strings.Contains(err.Error(), "no such file or directory") {
if err == nil || !os.IsNotExist(err) {
t.Fatal(err)
}
}
Expand Down Expand Up @@ -454,7 +453,7 @@ func TestReadSegmentByIndex_ENOENT(t *testing.T) {
os.RemoveAll(path)

_, err := messaging.ReadSegmentByIndex(path, 0)
if err == nil || !strings.Contains(err.Error(), "no such file or directory") {
if err == nil || !os.IsNotExist(err) {
t.Fatalf("unexpected error: %s", err)
}
}
Expand Down
6 changes: 5 additions & 1 deletion messaging/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/url"
"os"
"reflect"
"runtime"
"strings"
"testing"

Expand Down Expand Up @@ -73,6 +74,9 @@ func TestClient_Open_WithInvalidConfig(t *testing.T) {

// Ensure a client can return an error if the configuration file has non-readable permissions.
func TestClient_Open_WithBadPermConfig(t *testing.T) {
if "windows" == runtime.GOOS {
t.Skip("skip it on the windows")
}
// Write inaccessible configuration file.
path := NewTempFile()
defer os.Remove(path)
Expand All @@ -82,7 +86,7 @@ func TestClient_Open_WithBadPermConfig(t *testing.T) {
// Open new client against path.
c := NewClient()
if err := c.Open(path); err == nil || !strings.Contains(err.Error(), `permission denied`) {
t.Fatalf("unexpected error: %s", err)
t.Fatalf("unexpected error: %v", err)
}
defer c.Close()
}
Expand Down

0 comments on commit e129c53

Please sign in to comment.