fix: skip reg.ru tests on CI

This commit is contained in:
Fernandez Ludovic 2023-01-03 02:45:25 +01:00
parent a824cab316
commit 368427a621

View file

@ -1,7 +1,10 @@
package internal
import (
"net/http"
"os"
"testing"
"time"
"github.com/stretchr/testify/require"
)
@ -17,12 +20,18 @@ func TestRemoveRecord(t *testing.T) {
t.Skip("there is a bug with the reg.ru API: INTERNAL_API_ERROR: Внутренняя ошибка, status code: 503")
client := NewClient(officialTestUser, officialTestPassword)
client.HTTPClient = &http.Client{Timeout: 30 * time.Second}
err := client.RemoveTxtRecord("test.ru", "_acme-challenge", "txttxttxt")
require.NoError(t, err)
}
func TestRemoveRecord_errors(t *testing.T) {
// TODO(ldez): remove skip when the reg.ru API will be fixed.
if os.Getenv("CI") == "true" {
t.Skip("there is a bug with the reg.ru and GitHub action: dial tcp 194.58.116.30:443: i/o timeout")
}
testCases := []struct {
desc string
domain string
@ -55,6 +64,8 @@ func TestRemoveRecord_errors(t *testing.T) {
t.Parallel()
client := NewClient(test.username, test.username)
client.HTTPClient = &http.Client{Timeout: 30 * time.Second}
client.BaseURL = test.baseURL
err := client.RemoveTxtRecord(test.domain, "_acme-challenge", "txttxttxt")
require.EqualError(t, err, test.expected)
@ -67,12 +78,18 @@ func TestAddTXTRecord(t *testing.T) {
t.Skip("there is a bug with the reg.ru API: INTERNAL_API_ERROR: Внутренняя ошибка, status code: 503")
client := NewClient(officialTestUser, officialTestPassword)
client.HTTPClient = &http.Client{Timeout: 30 * time.Second}
err := client.AddTXTRecord("test.ru", "_acme-challenge", "txttxttxt")
require.NoError(t, err)
}
func TestAddTXTRecord_errors(t *testing.T) {
// TODO(ldez): remove skip when the reg.ru API will be fixed.
if os.Getenv("CI") == "true" {
t.Skip("there is a bug with the reg.ru and GitHub action: dial tcp 194.58.116.30:443: i/o timeout")
}
testCases := []struct {
desc string
domain string
@ -105,6 +122,8 @@ func TestAddTXTRecord_errors(t *testing.T) {
t.Parallel()
client := NewClient(test.username, test.username)
client.HTTPClient = &http.Client{Timeout: 30 * time.Second}
client.BaseURL = test.baseURL
err := client.AddTXTRecord(test.domain, "_acme-challenge", "txttxttxt")
require.EqualError(t, err, test.expected)