Skip to content

Commit

Permalink
style(tests): ShouldNot(HaveOccurred()) -> Should(Succeed())
Browse files Browse the repository at this point in the history
  • Loading branch information
ThinkChaos committed Dec 1, 2023
1 parent a330174 commit fe5c753
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions config/config_test.go
Expand Up @@ -278,7 +278,7 @@ blocking:
data := "bootstrapDns: 0.0.0.0"

err := unmarshalConfig([]byte(data), &cfg)
Expect(err).ShouldNot(HaveOccurred())
Expect(err).Should(Succeed())
Expect(cfg.BootstrapDNS[0].Upstream.Host).Should(Equal("0.0.0.0"))
})
It("should be backwards compatible to 'single item definition'", func() {
Expand All @@ -290,7 +290,7 @@ bootstrapDns:
- 0.0.0.0
`
err := unmarshalConfig([]byte(data), &cfg)
Expect(err).ShouldNot(HaveOccurred())
Expect(err).Should(Succeed())
Expect(cfg.BootstrapDNS[0].Upstream.Host).Should(Equal("dns.example.com"))
Expect(cfg.BootstrapDNS[0].IPs).Should(HaveLen(1))
})
Expand All @@ -304,7 +304,7 @@ bootstrapDns:
- upstream: 1.2.3.4
`
err := unmarshalConfig([]byte(data), &cfg)
Expect(err).ShouldNot(HaveOccurred())
Expect(err).Should(Succeed())
Expect(cfg.BootstrapDNS).Should(HaveLen(2))
Expect(cfg.BootstrapDNS[0].Upstream.Host).Should(Equal("dns.example.com"))
Expect(cfg.BootstrapDNS[0].Upstream.Net).Should(Equal(NetProtocolTcpTls))
Expand Down
4 changes: 2 additions & 2 deletions resolver/ecs_resolver_test.go
Expand Up @@ -42,7 +42,7 @@ var _ = Describe("EcsResolver", func() {
DeferCleanup(cancelFn)

err = defaults.Set(&sutConfig)
Expect(err).ShouldNot(HaveOccurred())
Expect(err).Should(Succeed())

mockAnswer = new(dns.Msg)
origIP = net.ParseIP("1.2.3.4")
Expand Down Expand Up @@ -184,7 +184,7 @@ var _ = Describe("EcsResolver", func() {
mask := config.ECSv4Mask(24)

mip, err := maskIP(ip, mask)
Expect(err).ShouldNot(HaveOccurred())
Expect(err).Should(Succeed())
Expect(mip).Should(Equal(net.ParseIP("192.168.10.0").To4()))
})
})
Expand Down
2 changes: 1 addition & 1 deletion resolver/parallel_best_resolver_test.go
Expand Up @@ -120,7 +120,7 @@ var _ = Describe("ParallelBestResolver", Label("parallelBestResolver"), func() {
sutVerify = noVerifyUpstreams
})
It("should start", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(err).Should(Succeed())
})
})
})
Expand Down
4 changes: 2 additions & 2 deletions resolver/strict_resolver_test.go
Expand Up @@ -112,7 +112,7 @@ var _ = Describe("StrictResolver", Label("strictResolver"), func() {
})

It("should start normally", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(err).Should(Succeed())
})
})

Expand All @@ -138,7 +138,7 @@ var _ = Describe("StrictResolver", Label("strictResolver"), func() {
sutVerify = noVerifyUpstreams
})
It("should start", func() {
Expect(err).ShouldNot(HaveOccurred())
Expect(err).Should(Succeed())
})
})
})
Expand Down

0 comments on commit fe5c753

Please sign in to comment.