lego/providers/dns/nifcloud/nifcloud_test.go
Ludovic Fernandez ad20bf90ff Migrate to golangci-lint (#644)
* refactor: linting.

- errcheck
- govet
- golint
- goconst
- spellcheck
- ...

* refactor: migrate from gometalinter to golangci-lint.
2018-09-24 19:07:20 +00:00

52 lines
1 KiB
Go

package nifcloud
import (
"os"
"testing"
"time"
"github.com/stretchr/testify/require"
)
var (
nifcloudLiveTest bool
nifcloudAccessKey string
nifcloudSecretKey string
nifcloudDomain string
)
func init() {
nifcloudAccessKey = os.Getenv("NIFCLOUD_ACCESS_KEY_ID")
nifcloudSecretKey = os.Getenv("NIFCLOUD_SECRET_ACCESS_KEY")
nifcloudDomain = os.Getenv("NIFCLOUD_DOMAIN")
if len(nifcloudAccessKey) > 0 && len(nifcloudSecretKey) > 0 && len(nifcloudDomain) > 0 {
nifcloudLiveTest = true
}
}
func TestLivenifcloudPresent(t *testing.T) {
if !nifcloudLiveTest {
t.Skip("skipping live test")
}
provider, err := NewDNSProvider()
require.NoError(t, err)
err = provider.Present(nifcloudDomain, "", "123d==")
require.NoError(t, err)
}
func TestLivenifcloudCleanUp(t *testing.T) {
if !nifcloudLiveTest {
t.Skip("skipping live test")
}
time.Sleep(time.Second * 1)
provider, err := NewDNSProvider()
require.NoError(t, err)
err = provider.CleanUp(nifcloudDomain, "", "123d==")
require.NoError(t, err)
}