Skip to content

Commit eced52f

Browse files
Chore: clean up tests for Expire and ExpireAt extra commands
1 parent 87c5e33 commit eced52f

File tree

1 file changed

+2
-46
lines changed

1 file changed

+2
-46
lines changed

commands_test.go

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -510,22 +510,6 @@ var _ = Describe("Commands", func() {
510510
expire := client.ExpireNX(ctx, "key", 10*time.Second)
511511
Expect(expire.Err()).NotTo(HaveOccurred())
512512
Expect(expire.Val()).To(Equal(true))
513-
514-
ttl := client.TTL(ctx, "key")
515-
Expect(ttl.Err()).NotTo(HaveOccurred())
516-
Expect(ttl.Val()).To(BeNumerically("~", 10*time.Second, time.Second))
517-
518-
expire = client.ExpireNX(ctx, "key", 10*time.Second)
519-
Expect(expire.Err()).NotTo(HaveOccurred())
520-
Expect(expire.Val()).To(Equal(false))
521-
522-
set = client.Set(ctx, "key", "Hello World", 0)
523-
Expect(set.Err()).NotTo(HaveOccurred())
524-
Expect(set.Val()).To(Equal("OK"))
525-
526-
ttl = client.TTL(ctx, "key")
527-
Expect(ttl.Err()).NotTo(HaveOccurred())
528-
Expect(ttl.Val()).To(Equal(time.Duration(-1)))
529513
})
530514

531515
It("should ExpireXX", func() {
@@ -548,26 +532,14 @@ var _ = Describe("Commands", func() {
548532
ttl := client.TTL(ctx, "key")
549533
Expect(ttl.Err()).NotTo(HaveOccurred())
550534
Expect(ttl.Val()).To(BeNumerically("~", 20*time.Second, 10*time.Second))
551-
552-
set = client.Set(ctx, "key", "Hello World", 0)
553-
Expect(set.Err()).NotTo(HaveOccurred())
554-
Expect(set.Val()).To(Equal("OK"))
555-
556-
ttl = client.TTL(ctx, "key")
557-
Expect(ttl.Err()).NotTo(HaveOccurred())
558-
Expect(ttl.Val()).To(Equal(time.Duration(-1)))
559535
})
560536

561537
It("should ExpireGT", func() {
562-
set := client.Set(ctx, "key", "Hello", 0)
538+
set := client.Set(ctx, "key", "Hello", 10*time.Second)
563539
Expect(set.Err()).NotTo(HaveOccurred())
564540
Expect(set.Val()).To(Equal("OK"))
565541

566-
expire := client.Expire(ctx, "key", 10*time.Second)
567-
Expect(expire.Err()).NotTo(HaveOccurred())
568-
Expect(expire.Val()).To(Equal(true))
569-
570-
expire = client.ExpireGT(ctx, "key", 5*time.Second)
542+
expire := client.ExpireGT(ctx, "key", 5*time.Second)
571543
Expect(expire.Err()).NotTo(HaveOccurred())
572544
Expect(expire.Val()).To(Equal(false))
573545

@@ -578,14 +550,6 @@ var _ = Describe("Commands", func() {
578550
ttl := client.TTL(ctx, "key")
579551
Expect(ttl.Err()).NotTo(HaveOccurred())
580552
Expect(ttl.Val()).To(BeNumerically("~", 20*time.Second, 10*time.Second))
581-
582-
set = client.Set(ctx, "key", "Hello World", 0)
583-
Expect(set.Err()).NotTo(HaveOccurred())
584-
Expect(set.Val()).To(Equal("OK"))
585-
586-
ttl = client.TTL(ctx, "key")
587-
Expect(ttl.Err()).NotTo(HaveOccurred())
588-
Expect(ttl.Val()).To(Equal(time.Duration(-1)))
589553
})
590554

591555
It("should ExpireLT", func() {
@@ -604,14 +568,6 @@ var _ = Describe("Commands", func() {
604568
ttl := client.TTL(ctx, "key")
605569
Expect(ttl.Err()).NotTo(HaveOccurred())
606570
Expect(ttl.Val()).To(BeNumerically("~", 5*time.Second, time.Second))
607-
608-
set = client.Set(ctx, "key", "Hello World", 0)
609-
Expect(set.Err()).NotTo(HaveOccurred())
610-
Expect(set.Val()).To(Equal("OK"))
611-
612-
ttl = client.TTL(ctx, "key")
613-
Expect(ttl.Err()).NotTo(HaveOccurred())
614-
Expect(ttl.Val()).To(Equal(time.Duration(-1)))
615571
})
616572

617573
It("should ExpireAt", func() {

0 commit comments

Comments
 (0)