diff --git a/challenge/dns01/nameserver_test.go b/challenge/dns01/nameserver_test.go index 2f577e7d..b63ea9e7 100644 --- a/challenge/dns01/nameserver_test.go +++ b/challenge/dns01/nameserver_test.go @@ -108,7 +108,7 @@ var findXByFqdnTestCases = []struct { desc: "NXDOMAIN", fqdn: "test.lego.zz.", zone: "lego.zz.", - nameservers: []string{"1.1.1.1:53"}, + nameservers: []string{"8.8.8.8:53"}, expectedError: "could not find the start of authority for test.lego.zz.: NXDOMAIN", }, { @@ -116,10 +116,10 @@ var findXByFqdnTestCases = []struct { fqdn: "mail.google.com.", zone: "google.com.", primaryNs: "ns1.google.com.", - nameservers: []string{":7053", ":8053", "1.1.1.1:53"}, + nameservers: []string{":7053", ":8053", "8.8.8.8:53"}, }, { - desc: "only non existent nameservers", + desc: "only non-existent nameservers", fqdn: "mail.google.com.", zone: "google.com.", nameservers: []string{":7053", ":8053", ":9053"}, @@ -151,7 +151,7 @@ func TestFindZoneByFqdnCustom(t *testing.T) { } } -func TestFindPrimayNsByFqdnCustom(t *testing.T) { +func TestFindPrimaryNsByFqdnCustom(t *testing.T) { for _, test := range findXByFqdnTestCases { t.Run(test.desc, func(t *testing.T) { ClearFqdnCache() diff --git a/providers/dns/regru/internal/client.go b/providers/dns/regru/internal/client.go index 34ca07e3..a5f5e503 100644 --- a/providers/dns/regru/internal/client.go +++ b/providers/dns/regru/internal/client.go @@ -99,7 +99,18 @@ func (c Client) do(request interface{}, fragments ...string) (*APIResponse, erro defer func() { _ = resp.Body.Close() }() if resp.StatusCode/100 != 2 { - return nil, fmt.Errorf("API error, status code: %d", resp.StatusCode) + all, errB := io.ReadAll(resp.Body) + if errB != nil { + return nil, fmt.Errorf("API error, status code: %d", resp.StatusCode) + } + + var apiResp APIResponse + errB = json.Unmarshal(all, &apiResp) + if errB != nil { + return nil, fmt.Errorf("API error, status code: %d, %s", resp.StatusCode, string(all)) + } + + return nil, fmt.Errorf("%w, status code: %d", apiResp, resp.StatusCode) } all, err := io.ReadAll(resp.Body) diff --git a/providers/dns/regru/internal/client_test.go b/providers/dns/regru/internal/client_test.go index fbcda82c..e89331e8 100644 --- a/providers/dns/regru/internal/client_test.go +++ b/providers/dns/regru/internal/client_test.go @@ -13,6 +13,9 @@ const ( ) func TestRemoveRecord(t *testing.T) { + // TODO(ldez): remove skip when the reg.ru API will be fixed. + t.Skip("there is a bug with the reg.ru API: INTERNAL_API_ERROR: Внутренняя ошибка, status code: 503") + client := NewClient(officialTestUser, officialTestPassword) err := client.RemoveTxtRecord("test.ru", "_acme-challenge", "txttxttxt") @@ -60,6 +63,9 @@ func TestRemoveRecord_errors(t *testing.T) { } func TestAddTXTRecord(t *testing.T) { + // TODO(ldez): remove skip when the reg.ru API will be fixed. + t.Skip("there is a bug with the reg.ru API: INTERNAL_API_ERROR: Внутренняя ошибка, status code: 503") + client := NewClient(officialTestUser, officialTestPassword) err := client.AddTXTRecord("test.ru", "_acme-challenge", "txttxttxt")