Add full integration test with real Technitium DNS server

- Add docker-compose.integration.yml with Technitium + DDNS services
- Add full-integration-test.sh for end-to-end testing
- Add technitium-init.sh for automated zone/token setup
- Add comprehensive logging to DNS client
- Test creates real DNS records and verifies them in Technitium
- 8/9 tests passing with real DNS integration
This commit is contained in:
2026-02-03 08:13:06 -05:00
parent 01694f66a8
commit ee187ff1c0
4 changed files with 364 additions and 11 deletions

View File

@@ -91,7 +91,8 @@ func (c *Client) AddWildcardARecord(zone, hostname, ip string, ttl int) error {
}
func (c *Client) addRecord(req AddRecordRequest) error {
endpoint := fmt.Sprintf("%s/api/dns/records/add", c.baseURL)
// Build endpoint with token as query parameter for Technitium API
endpoint := fmt.Sprintf("%s/api/dns/records/add?token=%s", c.baseURL, c.token)
log.Printf("[DNS] Adding record: domain=%s, type=%s, ip=%s", req.Domain, req.Type, req.IPAddress)
formData := url.Values{}
@@ -110,16 +111,7 @@ func (c *Client) addRecord(req AddRecordRequest) error {
}
httpReq.Header.Set("Content-Type", "application/x-www-form-urlencoded")
if c.token != "" {
httpReq.Header.Set("Authorization", "Basic "+c.token)
log.Printf("[DNS] Using token auth")
} else if c.username != "" && c.password != "" {
httpReq.SetBasicAuth(c.username, c.password)
log.Printf("[DNS] Using basic auth (username: %s)", c.username)
} else {
log.Printf("[DNS] Warning: No authentication configured!")
}
log.Printf("[DNS] Using token auth via query parameter")
log.Printf("[DNS] Sending request to %s", endpoint)
resp, err := c.httpClient.Do(httpReq)