From bca8659b542abde08f95c20ea679aae373a0fd75 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Mon, 18 May 2015 14:43:08 +0300 Subject: [PATCH] Run tests against latest Redis version. --- commands_test.go | 4 ++-- main_test.go | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/commands_test.go b/commands_test.go index a13ced6..dd7c6d6 100644 --- a/commands_test.go +++ b/commands_test.go @@ -273,7 +273,7 @@ var _ = Describe("Commands", func() { }) It("should Migrate", func() { - migrate := client.Migrate("localhost", "6380", "key", 0, 0) + migrate := client.Migrate("localhost", redisSecondaryPort, "key", 0, 0) Expect(migrate.Err()).NotTo(HaveOccurred()) Expect(migrate.Val()).To(Equal("NOKEY")) @@ -281,7 +281,7 @@ var _ = Describe("Commands", func() { Expect(set.Err()).NotTo(HaveOccurred()) Expect(set.Val()).To(Equal("OK")) - migrate = client.Migrate("localhost", "6380", "key", 0, 0) + migrate = client.Migrate("localhost", redisSecondaryPort, "key", 0, 0) Expect(migrate.Err()).To(MatchError("IOERR error or timeout writing to target instance")) Expect(migrate.Val()).To(Equal("")) }) diff --git a/main_test.go b/main_test.go index 5903273..57eb493 100644 --- a/main_test.go +++ b/main_test.go @@ -17,7 +17,11 @@ import ( "gopkg.in/redis.v3" ) -const redisAddr = ":6379" +const ( + redisPort = "6380" + redisAddr = ":" + redisPort + redisSecondaryPort = "6381" +) const ( sentinelName = "mymaster" @@ -27,7 +31,7 @@ const ( sentinelPort = "8126" ) -var sentinelMaster, sentinelSlave1, sentinelSlave2, sentinel *redisProcess +var redisMain, sentinelMaster, sentinelSlave1, sentinelSlave2, sentinel *redisProcess var cluster = &clusterScenario{ ports: []string{"8220", "8221", "8222", "8223", "8224", "8225"}, @@ -39,6 +43,9 @@ var cluster = &clusterScenario{ var _ = BeforeSuite(func() { var err error + redisMain, err = startRedis(redisPort) + Expect(err).NotTo(HaveOccurred()) + sentinelMaster, err = startRedis(sentinelMasterPort) Expect(err).NotTo(HaveOccurred()) @@ -57,6 +64,8 @@ var _ = BeforeSuite(func() { }) var _ = AfterSuite(func() { + Expect(redisMain.Close()).NotTo(HaveOccurred()) + Expect(sentinel.Close()).NotTo(HaveOccurred()) Expect(sentinelSlave1.Close()).NotTo(HaveOccurred()) Expect(sentinelSlave2.Close()).NotTo(HaveOccurred())