From: Björn Baumbach Date: Tue, 21 Feb 2023 17:00:41 +0000 (+0100) Subject: testprogs: add test for new net ads dns register --dns-ttl option X-Git-Tag: talloc-2.4.1~1488 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=529ef99d7c546de5a655de83a87b6de98459cc07;p=thirdparty%2Fsamba.git testprogs: add test for new net ads dns register --dns-ttl option Signed-off-by: Björn Baumbach Reviewed-by: Andrew Bartlett --- diff --git a/testprogs/blackbox/test_net_ads_dns.sh b/testprogs/blackbox/test_net_ads_dns.sh index a8a14fe234b..8a85913c68a 100755 --- a/testprogs/blackbox/test_net_ads_dns.sh +++ b/testprogs/blackbox/test_net_ads_dns.sh @@ -159,4 +159,40 @@ testit_grep_count \ dig @$SERVER +short -t aaaa $MACHINENAME.$REALM || failed=$(expr $failed + 1) +# Tests with --dns-ttl option +testit "net ads dns register with default TTL" \ + $net_tool ads dns register $MACHINENAME.$REALM $IPADDRMAC -P || + failed=$(expr $failed + 1) +TTL=$(dig @$SERVER.$REALM +noall +ttlid +answer -t A $MACHINENAME.$REALM | + awk '{ print $2 }') +testit "Verify default TTL of 3600 seconds" \ + test "$TTL" = "3600" || + failed=$(expr $failed + 1) + +testit "Update record with TTL of 60 seconds" \ + $net_tool ads dns register --dns-ttl 60 --force $MACHINENAME.$REALM $IPADDRMAC -P || + failed=$(expr $failed + 1) +TTL=$(dig @$SERVER.$REALM +noall +ttlid +answer -t A $MACHINENAME.$REALM | + awk '{ print $2 }') +testit "Verify new TTL of 60 seconds" \ + test "$TTL" = "60" || + failed=$(expr $failed + 1) + +testit "We should be able to unregister the name $MACHINENAME.$REALM $IPADDRESS" \ + $VALGRIND $net_tool ads dns unregister $MACHINENAME.$REALM -P || + failed=$(expr $failed + 1) + +testit_grep_count \ + "The name $MACHINENAME.$REALM ($IPADDRESS) should not be there any longer" \ + "$IPADDRESS" \ + 0 \ + dig @$SERVER.$REALM +short -t A $MACHINENAME.$REALM || + failed=$(expr $failed + 1) +testit_grep_count \ + "The name $MACHINENAME.$REALM ($IP6ADDRESS) should not be there any longer" \ + "$IP6ADDRESS" \ + 0 \ + dig @$SERVER.$REALM +short -t AAAA $MACHINENAME.$REALM || + failed=$(expr $failed + 1) + testok $0 $failed