11package internal
22
33import (
4+ "net/http"
5+ "os"
46 "testing"
7+ "time"
58
69 "github.com/stretchr/testify/require"
710)
@@ -17,12 +20,18 @@ func TestRemoveRecord(t *testing.T) {
1720 t .Skip ("there is a bug with the reg.ru API: INTERNAL_API_ERROR: Внутренняя ошибка, status code: 503" )
1821
1922 client := NewClient (officialTestUser , officialTestPassword )
23+ client .HTTPClient = & http.Client {Timeout : 30 * time .Second }
2024
2125 err := client .RemoveTxtRecord ("test.ru" , "_acme-challenge" , "txttxttxt" )
2226 require .NoError (t , err )
2327}
2428
2529func TestRemoveRecord_errors (t * testing.T ) {
30+ // TODO(ldez): remove skip when the reg.ru API will be fixed.
31+ if os .Getenv ("CI" ) == "true" {
32+ t .Skip ("there is a bug with the reg.ru and GitHub action: dial tcp 194.58.116.30:443: i/o timeout" )
33+ }
34+
2635 testCases := []struct {
2736 desc string
2837 domain string
@@ -55,6 +64,8 @@ func TestRemoveRecord_errors(t *testing.T) {
5564 t .Parallel ()
5665
5766 client := NewClient (test .username , test .username )
67+ client .HTTPClient = & http.Client {Timeout : 30 * time .Second }
68+ client .BaseURL = test .baseURL
5869
5970 err := client .RemoveTxtRecord (test .domain , "_acme-challenge" , "txttxttxt" )
6071 require .EqualError (t , err , test .expected )
@@ -67,12 +78,18 @@ func TestAddTXTRecord(t *testing.T) {
6778 t .Skip ("there is a bug with the reg.ru API: INTERNAL_API_ERROR: Внутренняя ошибка, status code: 503" )
6879
6980 client := NewClient (officialTestUser , officialTestPassword )
81+ client .HTTPClient = & http.Client {Timeout : 30 * time .Second }
7082
7183 err := client .AddTXTRecord ("test.ru" , "_acme-challenge" , "txttxttxt" )
7284 require .NoError (t , err )
7385}
7486
7587func TestAddTXTRecord_errors (t * testing.T ) {
88+ // TODO(ldez): remove skip when the reg.ru API will be fixed.
89+ if os .Getenv ("CI" ) == "true" {
90+ t .Skip ("there is a bug with the reg.ru and GitHub action: dial tcp 194.58.116.30:443: i/o timeout" )
91+ }
92+
7693 testCases := []struct {
7794 desc string
7895 domain string
@@ -105,6 +122,8 @@ func TestAddTXTRecord_errors(t *testing.T) {
105122 t .Parallel ()
106123
107124 client := NewClient (test .username , test .username )
125+ client .HTTPClient = & http.Client {Timeout : 30 * time .Second }
126+ client .BaseURL = test .baseURL
108127
109128 err := client .AddTXTRecord (test .domain , "_acme-challenge" , "txttxttxt" )
110129 require .EqualError (t , err , test .expected )
0 commit comments