github.com/dmaizel/tests@v0.0.0-20210728163746-cae6a2d9cee8/integration/kubernetes/k8s-custom-dns.bats (about) 1 #!/usr/bin/env bats 2 # 3 # Copyright (c) 2019 Intel Corporation 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 # 7 8 load "${BATS_TEST_DIRNAME}/../../.ci/lib.sh" 9 load "${BATS_TEST_DIRNAME}/tests_common.sh" 10 11 setup() { 12 export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config}" 13 pod_name="custom-dns-test" 14 file_name="/etc/resolv.conf" 15 get_pod_config_dir 16 } 17 18 @test "Check custom dns" { 19 # Create the pod 20 kubectl create -f "${pod_config_dir}/pod-custom-dns.yaml" 21 22 # Check pod creation 23 kubectl wait --for=condition=Ready --timeout=$timeout pod $pod_name 24 25 # Check dns config at /etc/resolv.conf 26 kubectl exec "$pod_name" -- cat "$file_name" | grep -q "nameserver 1.2.3.4" 27 kubectl exec "$pod_name" -- cat "$file_name" | grep -q "search dns.test.search" 28 } 29 30 teardown() { 31 # Debugging information 32 kubectl describe "pod/$pod_name" 33 34 kubectl delete pod "$pod_name" 35 }