diff --git a/tests/integration/admin_test.go b/tests/integration/admin_test.go deleted file mode 100644 index 0d7351631..000000000 --- a/tests/integration/admin_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package pika_integration - -import ( - "context" - "time" - - . "github.com/bsm/ginkgo/v2" - . "github.com/bsm/gomega" - "github.com/redis/go-redis/v9" -) - -var _ = Describe("admin test", func() { - ctx := context.TODO() - var client *redis.Client - - BeforeEach(func() { - client = redis.NewClient(PikaOption(SINGLEADDR)) - Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred()) - time.Sleep(1 * time.Second) - }) - - AfterEach(func() { - Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred()) - time.Sleep(1 * time.Second) - Expect(client.Close()).NotTo(HaveOccurred()) - }) - - It("should info", func() { - set := client.Set(ctx, "key", "foobar", 0) - Expect(set.Err()).NotTo(HaveOccurred()) - Expect(set.Val()).To(Equal("OK")) - - bitCount := client.BitCount(ctx, "key", nil) - Expect(bitCount.Err()).NotTo(HaveOccurred()) - Expect(bitCount.Val()).To(Equal(int64(26))) - - set1 := client.Set(ctx, "key1", "value1", 0) - Expect(set1.Err()).NotTo(HaveOccurred()) - Expect(set1.Val()).To(Equal("OK")) - - set2 := client.Set(ctx, "key2", "value2", 0) - Expect(set2.Err()).NotTo(HaveOccurred()) - Expect(set2.Val()).To(Equal("OK")) - - set3 := client.Set(ctx, "key3", "value3", 0) - Expect(set3.Err()).NotTo(HaveOccurred()) - Expect(set3.Val()).To(Equal("OK")) - - set4 := client.Set(ctx, "key4", "value4", 0) - Expect(set4.Err()).NotTo(HaveOccurred()) - Expect(set4.Val()).To(Equal("OK")) - - lPush := client.LPush(ctx, "key2", "b") - Expect(lPush.Err()).NotTo(HaveOccurred()) - - sAdd := client.SAdd(ctx, "key3", "c") - Expect(sAdd.Err()).NotTo(HaveOccurred()) - Expect(sAdd.Val()).To(Equal(int64(1))) - - infokeyspace := client.Info(ctx, "keyspace", "1") - Expect(infokeyspace.Err()).NotTo(HaveOccurred()) - Expect(infokeyspace.Val()).NotTo(Equal("")) - - start := time.Now() - infoall := client.Info(ctx, "all") - Expect(infoall.Err()).NotTo(HaveOccurred()) - Expect(infoall.Val()).NotTo(Equal("")) - end := time.Now() - duration := end.Sub(start) - Expect(duration).To(BeNumerically("<", time.Second)) - - start1 := time.Now() - infoacache := client.Info(ctx) - Expect(infoacache.Err()).NotTo(HaveOccurred()) - Expect(infoacache.Val()).NotTo(Equal("")) - end1 := time.Now() - duration1 := end1.Sub(start1) - Expect(duration1).To(BeNumerically("<", time.Second)) - - start2 := time.Now() - info := client.Info(ctx, "cache") - Expect(info.Err()).NotTo(HaveOccurred()) - Expect(info.Val()).NotTo(Equal("")) - end2 := time.Now() - duration2 := end2.Sub(start2) - Expect(duration2).To(BeNumerically("<", time.Second)) - }) - -}) diff --git a/tests/integration/server_test.go b/tests/integration/server_test.go index eed8f2283..de16cb137 100644 --- a/tests/integration/server_test.go +++ b/tests/integration/server_test.go @@ -321,7 +321,7 @@ var _ = Describe("Server", func() { Expect(r.Val()).To(Equal("OK")) }) - It("should ConfigSet", func() { + It("should ConfigSet maxmemory", func() { configGet := client.ConfigGet(ctx, "maxmemory") Expect(configGet.Err()).NotTo(HaveOccurred()) Expect(configGet.Val()).To(HaveLen(1)) @@ -333,43 +333,43 @@ var _ = Describe("Server", func() { //Expect(configSet.Val()).To(Equal("OK")) }) - It("should ConfigGet", func() { + It("should ConfigGet slotmigrate", func() { configGet := client.ConfigGet(ctx, "slotmigrate") Expect(configGet.Err()).NotTo(HaveOccurred()) Expect(configGet.Val()).To(Equal(map[string]string{"slotmigrate": "no"})) }) - It("should ConfigSet", func() { + It("should ConfigSet slotmigrate yes", func() { configSet := client.ConfigSet(ctx, "slotmigrate", "yes") Expect(configSet.Err()).NotTo(HaveOccurred()) Expect(configSet.Val()).To(Equal("OK")) }) - It("should ConfigGet", func() { + It("should ConfigGet slotmigrate-thread-num", func() { configGet1 := client.ConfigGet(ctx, "slotmigrate-thread-num") Expect(configGet1.Err()).NotTo(HaveOccurred()) Expect(configGet1.Val()).NotTo(Equal("0")) }) - It("should ConfigGet", func() { + It("should ConfigGet thread-migrate-keys-num", func() { configGet2 := client.ConfigGet(ctx, "thread-migrate-keys-num") Expect(configGet2.Err()).NotTo(HaveOccurred()) Expect(configGet2.Val()).NotTo(Equal("0")) }) - It("should ConfigSet", func() { + It("should ConfigSet slotmigrate-thread-num", func() { configSet1 := client.ConfigSet(ctx, "slotmigrate-thread-num", "4") Expect(configSet1.Err()).NotTo(HaveOccurred()) Expect(configSet1.Val()).To(Equal("OK")) }) - It("should ConfigSet", func() { + It("should ConfigSet thread-migrate-keys-num", func() { configSet2 := client.ConfigSet(ctx, "thread-migrate-keys-num", "64") Expect(configSet2.Err()).NotTo(HaveOccurred()) Expect(configSet2.Val()).To(Equal("OK")) }) - It("should ConfigGet", func() { + It("should ConfigGet block-cache", func() { configGet2 := client.ConfigGet(ctx, "block-cache") Expect(configGet2.Err()).NotTo(HaveOccurred()) Expect(configGet2.Val()).NotTo(Equal("0")) @@ -381,25 +381,25 @@ var _ = Describe("Server", func() { Expect(configRewrite.Val()).To(Equal("OK")) }) - It("should ConfigGet", func() { + It("should ConfigGet block-cache", func() { configGet3 := client.ConfigGet(ctx, "block-cache") Expect(configGet3.Err()).NotTo(HaveOccurred()) Expect(configGet3.Val()).To(Equal(map[string]string{"block-cache": "8388608"})) }) - It("should ConfigGet", func() { + It("should ConfigGet slotmigrate-thread-num", func() { configGet4 := client.ConfigGet(ctx, "slotmigrate-thread-num") Expect(configGet4.Err()).NotTo(HaveOccurred()) Expect(configGet4.Val()).To(Equal(map[string]string{"slotmigrate-thread-num": "4"})) }) - It("should ConfigGet", func() { + It("should ConfigGet thread-migrate-keys-num", func() { configGet5 := client.ConfigGet(ctx, "thread-migrate-keys-num") Expect(configGet5.Err()).NotTo(HaveOccurred()) Expect(configGet5.Val()).To(Equal(map[string]string{"thread-migrate-keys-num": "64"})) }) - It("should ConfigSet", func() { + It("should ConfigSet slotmigrate", func() { configSet := client.ConfigSet(ctx, "slotmigrate", "no") Expect(configSet.Err()).NotTo(HaveOccurred()) Expect(configSet.Val()).To(Equal("OK")) diff --git a/tests/integration/txn_test.go b/tests/integration/txn_test.go index b96e18506..3161122a4 100644 --- a/tests/integration/txn_test.go +++ b/tests/integration/txn_test.go @@ -134,7 +134,7 @@ var _ = Describe("Text Txn", func() { }(&cmdCost) <-resultChann wg.Wait() - Expect(cmdCost < (txnCost / 5)).To(BeTrue()) + Expect(cmdCost < (txnCost / 4)).To(BeTrue()) }) })