diff options
author | Jonathan Turner <jt@jtnet.co.uk> | 2020-02-04 20:44:07 +0000 |
---|---|---|
committer | Jonathan Turner <jt@jtnet.co.uk> | 2020-02-04 20:44:07 +0000 |
commit | eb63c7d4d777c5fbc8dfced577f1d70ac4c51553 (patch) | |
tree | 9f57ee9019f67d1e726099439435040ec0ec1853 | |
parent | 522698a21dfbcf6420fe2354b6e8072632db545c (diff) |
update integration test
-rw-r--r-- | .github/workflows/testing.yml | 10 | ||||
-rw-r--r-- | .github/workflows/testingv2.yml | 10 | ||||
-rw-r--r-- | srv_integration_test.go | 7 | ||||
-rw-r--r-- | v2/srv_integration_test.go | 7 |
4 files changed, 28 insertions, 6 deletions
diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 46478fa..812485e 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -52,10 +52,19 @@ jobs: go vet $(go list ./... | grep -E -v '/v[0-9]+' | grep -v /vendor/) id: govet + - name: Start integration test dependencies + run: | + sudo docker run -d -h ns.test.gokrb5 -v /etc/localtime:/etc/localtime:ro -e "TEST_KDC_ADDR=${TEST_KDC_ADDR}" -e "TEST_HTTP_ADDR=${TEST_HTTP_ADDR}" -p ${DNSUTILS_OVERRIDE_NS}:53 -p ${DNSUTILS_OVERRIDE_NS}:53/udp --name dns jcmturner/gokrb5:dns + sudo sed -i 's/nameserver .*/nameserver '${DNS_IP}'/g' /etc/resolv.conf + dig _kerberos._udp.TEST.GOKRB5 + id: intgTestDeps + - name: Unit tests run: | cd ${HOME}/go/src/github.com/${GITHUB_REPOSITORY} go test -race $(go list ./... | grep -E -v '/v[0-9]+' | grep -v /vendor/) + env: + INTEGRATION: 1 id: unitTests - name: Unit tests (32bit) @@ -64,4 +73,5 @@ jobs: go test $(go list ./... | grep -E -v '/v[0-9]+' | grep -v /vendor/) env: GOARCH: 386 + INTEGRATION: 1 id: unitTest32
\ No newline at end of file diff --git a/.github/workflows/testingv2.yml b/.github/workflows/testingv2.yml index ec65a3e..6dfcc1d 100644 --- a/.github/workflows/testingv2.yml +++ b/.github/workflows/testingv2.yml @@ -38,10 +38,19 @@ jobs: go vet ./... id: govet + - name: Start integration test dependencies + run: | + sudo docker run -d -h ns.test.gokrb5 -v /etc/localtime:/etc/localtime:ro -e "TEST_KDC_ADDR=${TEST_KDC_ADDR}" -e "TEST_HTTP_ADDR=${TEST_HTTP_ADDR}" -p ${DNSUTILS_OVERRIDE_NS}:53 -p ${DNSUTILS_OVERRIDE_NS}:53/udp --name dns jcmturner/gokrb5:dns + sudo sed -i 's/nameserver .*/nameserver '${DNS_IP}'/g' /etc/resolv.conf + dig _kerberos._udp.TEST.GOKRB5 + id: intgTestDeps + - name: Unit tests run: | cd ${GITHUB_WORKFLOW} go test -race ./... + env: + INTEGRATION: 1 id: unitTests - name: Unit tests (32bit) @@ -50,4 +59,5 @@ jobs: go test ./... env: GOARCH: 386 + INTEGRATION: 1 id: unitTest32
\ No newline at end of file diff --git a/srv_integration_test.go b/srv_integration_test.go index 6ba8f51..66a7c29 100644 --- a/srv_integration_test.go +++ b/srv_integration_test.go @@ -1,16 +1,17 @@ -// +build integration -// To turn on this test use -tags=integration in go test command - package dnsutils import ( "github.com/stretchr/testify/assert" + "os" "strconv" "strings" "testing" ) func TestResolveKDC(t *testing.T) { + if os.Getenv("INTEGRATION") != "1" { + t.Skip("Skipping integration test") + } for i := 0; i < 100; i++ { count, res, err := OrderedSRV("kerberos", "tcp", "test.gokrb5") if err != nil { diff --git a/v2/srv_integration_test.go b/v2/srv_integration_test.go index 6ba8f51..66a7c29 100644 --- a/v2/srv_integration_test.go +++ b/v2/srv_integration_test.go @@ -1,16 +1,17 @@ -// +build integration -// To turn on this test use -tags=integration in go test command - package dnsutils import ( "github.com/stretchr/testify/assert" + "os" "strconv" "strings" "testing" ) func TestResolveKDC(t *testing.T) { + if os.Getenv("INTEGRATION") != "1" { + t.Skip("Skipping integration test") + } for i := 0; i < 100; i++ { count, res, err := OrderedSRV("kerberos", "tcp", "test.gokrb5") if err != nil { |