- Added configuration management using Viper in internal/config/config.go - Implemented ClientConfig, ServerConfig, TLSConfig, HetznerConfig, UpstreamConfig, and main Config struct. - Created LoadConfig function to read and validate configuration files. - Developed Hetzner DNS provider in internal/provider/hetzner/hetzner.go with methods for updating DNS records. - Added comprehensive unit tests for configuration loading and Hetzner provider functionality. - Established HTTP server with metrics and update endpoint in internal/server/server.go. - Implemented request handling, authorization, and error management in the server. - Created integration tests for the Hetzner provider API interactions. - Removed legacy dynamic DNS integration tests in favor of the new API-based approach.
23 lines
548 B
Go
23 lines
548 B
Go
package provider_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"git.cloonar.com/cloonar/updns/internal/provider"
|
|
)
|
|
|
|
// mockProvider is a dummy implementation for testing the Provider interface.
|
|
type mockProvider struct{}
|
|
|
|
func (m *mockProvider) UpdateRecord(ctx context.Context, domain, ip string) error {
|
|
return nil
|
|
}
|
|
|
|
func TestProviderInterfaceCompliance(t *testing.T) {
|
|
var p provider.Provider = &mockProvider{}
|
|
if err := p.UpdateRecord(context.Background(), "example.com", "1.2.3.4"); err != nil {
|
|
t.Errorf("expected no error, got %v", err)
|
|
}
|
|
}
|