Skip to content

Commit

Permalink
test(e2e): added more startVerifyUpstream tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xERR0R authored and ThinkChaos committed Dec 2, 2022
1 parent be5fce0 commit 4ad7670
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions e2e/upstream_test.go
Expand Up @@ -14,9 +14,10 @@ var _ = Describe("Upstream resolver configuration tests", func() {
var err error

Describe("'startVerifyUpstream' parameter handling", func() {
When("'startVerifyUpstream' is false and upstream server is not reachable", func() {
When("'startVerifyUpstream' is false and upstream server as IP is not reachable", func() {
BeforeEach(func() {
blocky, err = createBlockyContainer(tmpDir,
"logLevel: warn",
"upstream:",
" default:",
" - 192.192.192.192",
Expand All @@ -28,9 +29,28 @@ var _ = Describe("Upstream resolver configuration tests", func() {
})
It("should start even if upstream server is not reachable", func() {
Expect(blocky.IsRunning()).Should(BeTrue())
Expect(getContainerLogs(blocky)).Should(BeEmpty())
})
})
When("'startVerifyUpstream' is true and upstream server is not reachable", func() {
When("'startVerifyUpstream' is false and upstream server as host name is not reachable", func() {
BeforeEach(func() {
blocky, err = createBlockyContainer(tmpDir,
"logLevel: warn",
"upstream:",
" default:",
" - some.wrong.host",
"startVerifyUpstream: false",
)

Expect(err).Should(Succeed())
DeferCleanup(blocky.Terminate)
})
It("should start even if upstream server is not reachable", func() {
Expect(blocky.IsRunning()).Should(BeTrue())
Expect(getContainerLogs(blocky)).Should(BeEmpty())
})
})
When("'startVerifyUpstream' is true and upstream as IP address server is not reachable", func() {
BeforeEach(func() {
blocky, err = createBlockyContainer(tmpDir,
"upstream:",
Expand All @@ -48,6 +68,24 @@ var _ = Describe("Upstream resolver configuration tests", func() {
Should(ContainElement(ContainSubstring("no valid upstream for group default")))
})
})
When("'startVerifyUpstream' is true and upstream server as host name is not reachable", func() {
BeforeEach(func() {
blocky, err = createBlockyContainer(tmpDir,
"upstream:",
" default:",
" - some.wrong.host",
"startVerifyUpstream: true",
)

Expect(err).Should(HaveOccurred())
DeferCleanup(blocky.Terminate)
})
It("should not start", func() {
Expect(blocky.IsRunning()).Should(BeFalse())
Expect(getContainerLogs(blocky)).
Should(ContainElement(ContainSubstring("no valid upstream for group default")))
})
})
})
Describe("'upstreamTimeout' parameter handling", func() {
var moka testcontainers.Container
Expand Down Expand Up @@ -85,5 +123,4 @@ var _ = Describe("Upstream resolver configuration tests", func() {
})
})
})

})

0 comments on commit 4ad7670

Please sign in to comment.