mirror of https://github.com/go-redis/redis.git
Skip flaky tests.
This commit is contained in:
parent
46790aa060
commit
e37202e605
|
@ -139,7 +139,7 @@ func startCluster(scenario *clusterScenario) error {
|
|||
return fmt.Errorf("cluster did not reach consistent state (%v)", res)
|
||||
}
|
||||
return nil
|
||||
}, 10*time.Second)
|
||||
}, 30*time.Second)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ var _ = Describe("Command", func() {
|
|||
Describe("races", func() {
|
||||
var C, N = 10, 1000
|
||||
if testing.Short() {
|
||||
C = 3
|
||||
N = 100
|
||||
}
|
||||
|
||||
|
|
|
@ -57,16 +57,20 @@ var _ = Describe("Commands", func() {
|
|||
})
|
||||
|
||||
It("should BgRewriteAOF", func() {
|
||||
r := client.BgRewriteAOF()
|
||||
Expect(r.Err()).NotTo(HaveOccurred())
|
||||
Expect(r.Val()).To(ContainSubstring("Background append only file rewriting"))
|
||||
Skip("flaky test")
|
||||
|
||||
val, err := client.BgRewriteAOF().Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(val).To(ContainSubstring("Background append only file rewriting"))
|
||||
})
|
||||
|
||||
It("should BgSave", func() {
|
||||
Skip("flaky test")
|
||||
|
||||
// workaround for "ERR Can't BGSAVE while AOF log rewriting is in progress"
|
||||
Eventually(func() string {
|
||||
return client.BgSave().Val()
|
||||
}, "10s").Should(Equal("Background saving started"))
|
||||
}, "30s").Should(Equal("Background saving started"))
|
||||
})
|
||||
|
||||
It("should ClientKill", func() {
|
||||
|
|
|
@ -13,7 +13,8 @@ var client *redis.Client
|
|||
|
||||
func init() {
|
||||
client = redis.NewClient(&redis.Options{
|
||||
Addr: ":6379",
|
||||
Addr: ":6379",
|
||||
DialTimeout: 10 * time.Second,
|
||||
})
|
||||
client.FlushDb()
|
||||
}
|
||||
|
@ -247,30 +248,32 @@ func ExamplePubSub_Receive() {
|
|||
}
|
||||
defer pubsub.Close()
|
||||
|
||||
err = client.Publish("mychannel2", "hello").Err()
|
||||
n, err := client.Publish("mychannel2", "hello").Result()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(n, "clients received message")
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
for {
|
||||
// ReceiveTimeout is a low level API. Use ReceiveMessage instead.
|
||||
msgi, err := pubsub.ReceiveTimeout(time.Second)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
break
|
||||
}
|
||||
|
||||
switch msg := msgi.(type) {
|
||||
case *redis.Subscription:
|
||||
fmt.Println(msg.Kind, msg.Channel)
|
||||
fmt.Println("subscribed to", msg.Channel)
|
||||
case *redis.Message:
|
||||
fmt.Println(msg.Channel, msg.Payload)
|
||||
fmt.Println("received", msg.Payload, "from", msg.Channel)
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown message: %#v", msgi))
|
||||
panic(fmt.Errorf("unknown message: %#v", msgi))
|
||||
}
|
||||
}
|
||||
|
||||
// Output: subscribe mychannel2
|
||||
// mychannel2 hello
|
||||
// Output: 1 clients received message
|
||||
// subscribed to mychannel2
|
||||
// received hello from mychannel2
|
||||
}
|
||||
|
||||
func ExampleScript() {
|
||||
|
|
|
@ -30,6 +30,7 @@ type Options struct {
|
|||
|
||||
// Sets the deadline for establishing new connections. If reached,
|
||||
// dial will fail with a timeout.
|
||||
// Default is 5 seconds.
|
||||
DialTimeout time.Duration
|
||||
// Sets the deadline for socket reads. If reached, commands will
|
||||
// fail with a timeout instead of blocking.
|
||||
|
@ -43,7 +44,7 @@ type Options struct {
|
|||
PoolSize int
|
||||
// Specifies amount of time client waits for connection if all
|
||||
// connections are busy before returning an error.
|
||||
// Default is 1 seconds.
|
||||
// Default is 1 second.
|
||||
PoolTimeout time.Duration
|
||||
// Specifies amount of time after which client closes idle
|
||||
// connections. Should be less than server's timeout.
|
||||
|
|
Loading…
Reference in New Issue