forked from alphazero/Go-Redis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUGFIX / ADD async client connect fix and new asynchclient_test.go - …
…TESTED - FIX BUG client did not return connect errors - ADD test file for async clients (WIP) - MOD move common test funcs to 0_test.go - MOD use _test prefix for test util funcs
- Loading branch information
Joubin Houshyar
committed
Sep 14, 2012
1 parent
d94b330
commit c593219
Showing
8 changed files
with
114 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package redis | ||
|
||
import ( | ||
// "fmt" | ||
"log" | ||
"testing" | ||
) | ||
|
||
// Check that connection is actually passing passwords from spec | ||
// and catching AUTH ERRs. | ||
func TestAsyncClientConnectWithBadSpec(t *testing.T) { | ||
spec := _test_getDefConnSpec() | ||
spec.Password("bad-password") | ||
client, expected := NewAsynchClientWithSpec(spec) | ||
if expected == nil { | ||
t.Error("BUG: Expected a RedisError") | ||
} | ||
if client != nil { | ||
t.Error("BUG: async client reference on error MUST be nil") | ||
} | ||
} | ||
|
||
// Check that connection is actually passing passwords from spec | ||
func TestAsyncClientConnectWithSpec(t *testing.T) { | ||
spec := _test_getDefConnSpec() | ||
|
||
client, err := NewAsynchClientWithSpec(spec) | ||
if err != nil { | ||
t.Error("failed to create client with spec. Error: ", err.Message()) | ||
} else if client == nil { | ||
t.Error("BUG: client is nil") | ||
} | ||
client.Quit() | ||
} | ||
|
||
/* --------------- KEEP THIS AS LAST FUNCTION -------------- */ | ||
func TestEnd_asct(t *testing.T) { | ||
log.Println("-- asynchclient test completed") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters