func Dig(t *testing.T, dnsServer string, dnsPort int, dnsName string, additionalArgs ...string) ([]string, error) {
	port := fmt.Sprintf("-p%d", dnsPort)
	dnsServer = fmt.Sprintf("@%s", dnsServer)
	digApp := shell.Command{
		Command: "dig",
		Args:    append([]string{port, dnsServer, dnsName, "+short"}, additionalArgs...),
	}
	digAppOut := shell.RunCommandAndGetOutput(t, digApp)
	digAppSlice := strings.Split(digAppOut, "\n")
	sort.Strings(digAppSlice)
	return digAppSlice, nil
}
Dig gets sorted slice of records related to dnsName
package utils
import (
	"fmt"
	"io/ioutil"
	"log"
	"sort"
	"strings"
	"testing"
	"time"
	"github.com/gruntwork-io/terratest/modules/helm"
	"github.com/gruntwork-io/terratest/modules/k8s"
	"github.com/gruntwork-io/terratest/modules/retry"
	"github.com/gruntwork-io/terratest/modules/shell"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func GetIngressIPs(t *testing.T, options *k8s.KubectlOptions, ingressName string) []string {
	var ingressIPs []string
	ingress := k8s.GetIngress(t, options, ingressName)
	for _, lb := range ingress.Status.LoadBalancer.Ingress {
		if len(lb.IP) > 0 {
			ingressIPs = append(ingressIPs, lb.IP)
		} else if len(lb.Hostname) > 0 {
			digLbHostnameIPs, _ := Dig(t, "1.1.1.1", 53, lb.Hostname)
			log.Printf("Digging LB hostname %s, got %v", lb.Hostname, digLbHostnameIPs)
			ingressIPs = append(ingressIPs, digLbHostnameIPs...)
		}
	}
	return ingressIPs
}