{"record":{"id":"97dcf43b78250a81","repo":"kubernetes/kops","slug":"mockdns-not-set","errorCode":null,"errorMessage":"MockDNS not set","messagePattern":"MockDNS not set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/mock_cloud.go","lineNumber":151,"sourceCode":"func (c *MockCloud) DeregisterInstance(i *cloudinstances.CloudInstance) error {\n\treturn deregisterInstance(c, i.ID)\n}\n\nfunc (c *MockCloud) DetachInstance(i *cloudinstances.CloudInstance) error {\n\treturn detachInstance(c, i)\n}\n\nfunc (c *MockCloud) GetCloudGroups(cluster *kops.Cluster, instancegroups []*kops.InstanceGroup, warnUnmatched bool, nodes []v1.Node) (map[string]*cloudinstances.CloudInstanceGroup, error) {\n\treturn getCloudGroups(c, cluster, instancegroups, warnUnmatched, nodes)\n}\n\nfunc (c *MockCloud) ProviderID() kops.CloudProviderID {\n\treturn kops.CloudProviderOpenstack\n}\n\nfunc (c *MockCloud) DNS() (dnsprovider.Interface, error) {\n\tif c.MockDNSClient == nil {\n\t\treturn nil, fmt.Errorf(\"MockDNS not set\")\n\t}\n\treturn dnsproviderdesignate.New(c.DNSClient()), nil\n}\n\nfunc (c *MockCloud) FindVPCInfo(id string) (*fi.VPCInfo, error) {\n\treturn findVPCInfo(c, id, c.zones)\n}\n\nfunc (c *MockCloud) Region() string {\n\treturn c.region\n}\n\nfunc (c *MockCloud) AppendTag(resource string, id string, tag string) error {\n\treturn appendTag(c, resource, id, tag)\n}\n\nfunc (c *MockCloud) AssociateToPool(server *servers.Server, poolID string, opts v2pools.CreateMemberOpts) (association *v2pools.Member, err error) {\n\treturn associateToPool(c, server, poolID, opts)","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/mock_cloud.go#L133-L169","documentation":"The mock OpenStack cloud was asked to perform a DNS operation but its MockDNS field was never populated by the test. It is a sentinel-style guard: the test fixture is incomplete, not a production failure.","triggerScenarios":"Calling DNS() on a MockCloud built by newMockCloud without first assigning c.MockDNSClient.","commonSituations":"Unit tests of OpenStack DNS/designate integration using the mock cloud but forgetting to set the designate client; refactors that call DNS() in code paths tests did not previously cover.","solutions":[],"exampleFix":"// before\ncloud := openstack.NewMockCloud(t)\n_ = cloud.DNS()\n// after\ncloud := openstack.NewMockCloud(t)\ncloud.MockDNSClient = ... // init mock DNS client\n_ = cloud.DNS()","handlingStrategy":"validation","validationCode":"if cloud.MockDNSClient == nil {\n    t.Fatal(\"MockDNSClient must be initialized before test\")\n}","typeGuard":"func hasMockDNS(c *openstack.MockCloud) bool { return c.MockDNSClient != nil }","tryCatchPattern":null,"preventionTips":["Always construct mocks via test helpers that initialize all clients","Add a fixture/setup function that sets MockDNSClient before DNS-dependent tests","When refactoring, run the affected tests to catch new DNS() call paths"],"tags":["openstack","testing","mock","dns"],"backgroundTag":"missing-test-fixture","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}