-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8590 from concourse/dns-proxy-refactor
refactor dns package and test
- Loading branch information
Showing
10 changed files
with
122 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/concourse/concourse/integration/internal/dctest" | ||
"github.com/concourse/concourse/integration/internal/flytest" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDNSProxyEnabled(t *testing.T) { | ||
t.Parallel() | ||
|
||
dc := dctest.Init(t, "../docker-compose.yml", "overrides/enable_dns_proxy.yml") | ||
|
||
t.Run("deploy with DNS proxy enabled", func(t *testing.T) { | ||
dc.Run(t, "up", "-d") | ||
}) | ||
|
||
fly := flytest.Init(t, dc) | ||
fly.ExpectExit(0).Run(t, "execute", "-c", "tasks/resolve_web_dns.yml") | ||
} | ||
|
||
func TestDNSProxyDisabled(t *testing.T) { | ||
t.Parallel() | ||
|
||
dc := dctest.Init(t, "../docker-compose.yml", "overrides/disable_dns_proxy.yml") | ||
|
||
t.Run("deploy with DNS proxy disabled", func(t *testing.T) { | ||
dc.Run(t, "up", "-d") | ||
}) | ||
|
||
fly := flytest.Init(t, dc) | ||
fly.ExpectExit(1).Run(t, "execute", "-c", "tasks/resolve_web_dns.yml") | ||
} | ||
|
||
func TestExtraDNSServersAreAdded(t *testing.T) { | ||
t.Parallel() | ||
|
||
dc := dctest.Init(t, "../docker-compose.yml", "overrides/add_extra_dns_servers.yml") | ||
|
||
t.Run("deploy with extra DNS servers", func(t *testing.T) { | ||
dc.Run(t, "up", "-d") | ||
}) | ||
|
||
fly := flytest.Init(t, dc) | ||
output := fly.WithEnv("FILE=/etc/resolv.conf").Output(t, "execute", "-c", "tasks/cat_file.yml") | ||
require.Contains(t, output, "nameserver 1.1.1.1") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: '3' | ||
|
||
services: | ||
worker: | ||
environment: | ||
CONCOURSE_CONTAINERD_DNS_SERVER: "1.1.1.1" | ||
CONCOURSE_RUNTIME: containerd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: '3' | ||
|
||
services: | ||
worker: | ||
environment: | ||
CONCOURSE_CONTAINERD_DNS_PROXY_ENABLE: "false" | ||
CONCOURSE_RUNTIME: containerd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: '3' | ||
|
||
services: | ||
worker: | ||
environment: | ||
CONCOURSE_CONTAINERD_DNS_PROXY_ENABLE: "true" | ||
CONCOURSE_RUNTIME: containerd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
platform: linux | ||
|
||
image_resource: | ||
type: mock | ||
source: {mirror_self: true} | ||
|
||
params: | ||
FILE: | ||
|
||
run: | ||
path: sh | ||
args: | ||
- -c | ||
- | | ||
cat $FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
platform: linux | ||
|
||
image_resource: | ||
type: mock | ||
source: {mirror_self: true} | ||
|
||
run: | ||
path: sh | ||
args: | ||
- -c | ||
- | | ||
nslookup web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters