WIP - missed changes

This commit is contained in:
Gun Store 2020-11-26 00:24:14 +00:00
parent 99d2af76be
commit 8623314867
3 changed files with 13 additions and 33 deletions

View file

@ -13,22 +13,6 @@ import (
var i int
// func testingHTTPClient(handler http.Handler) (*http.Client, func()) {
// s := httptest.NewTLSServer(handler)
// cli := &http.Client{
// Transport: &http.Transport{
// DialContext: func(_ context.Context, network, _ string) (net.Conn, error) {
// return net.Dial(network, s.Listener.Addr().String())
// },
// TLSClientConfig: &tls.Config{
// InsecureSkipVerify: true,
// },
// },
// }
// return cli, s.Close
// }
func TestRemoveDNSRecord(t *testing.T) {
expectedMethod := "DELETE"
dnsID := "1"

View file

@ -227,7 +227,7 @@ func (c *customDNSProviderSolver) NewDynuClient(ch *v1alpha1.ChallengeRequest) (
return nil, &cfg, fmt.Errorf("error getting credentials: %v", err)
}
client := *&dynuclient.DynuClient{DNSID: creds.DNSID, APIKey: creds.APIKey, HTTPClient: c.httpClient}
client := &dynuclient.DynuClient{DNSID: creds.DNSID, APIKey: creds.APIKey, HTTPClient: c.httpClient}
return &client, &cfg, nil
return client, &cfg, nil
}

View file

@ -6,6 +6,7 @@ import (
"io/ioutil"
"log"
"net/http"
"os"
"testing"
"time"
@ -23,7 +24,7 @@ import (
)
var (
zone = "example.com." // os.Getenv("TEST_ZONE_NAME")
zone = os.Getenv("TEST_ZONE_NAME")
kubeBuilderBinPath = "./_out/kubebuilder/bin"
fqdn string
)
@ -69,7 +70,7 @@ func TestRunsSuite(t *testing.T) {
},
}
httpCall := 0
fqdn = "cert-manager-dns01-tests-with-secret." + zone
testHandlerFunc := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
assert.Equal(t, scenarios[httpCall].expected, req.URL.String(), scenarios[httpCall].scenario+" failed")
httpCall++
@ -85,7 +86,7 @@ func TestRunsSuite(t *testing.T) {
srv := &server.BasicServer{
Handler: &test.Handler{
Log: logf.FromContext(ctx, "dnsBasicServer"),
Log: logf.FromContext(ctx, "dnsBasicServerSecret"),
TxtRecords: map[string][][]string{
fqdn: {
{},
@ -121,12 +122,9 @@ func TestRunsSuite(t *testing.T) {
)
fixture.RunConformance(t)
for _, v := range scenarios {
fmt.Println("actual " + v.actual)
//assert.Equal(t, v.expected, v.actual, v.scenario+" failed")
}
}
func TestRunSuiteWithSecret(t *testing.T) {
t.Skip()
dnsResp := dynuclient.DNSResponse{
StatusCode: 200,
ID: 98765,
@ -135,7 +133,7 @@ func TestRunSuiteWithSecret(t *testing.T) {
NodeName: "nodeName",
Hostname: "hostName",
RecordType: "TXT",
TTL: 90,
TTL: 200,
State: true,
Content: "content",
UpdatedOn: "2020-10-29T23:00",
@ -163,14 +161,12 @@ func TestRunSuiteWithSecret(t *testing.T) {
},
}
httpCall := 0
// if os.Getenv("TEST_ZONE_NAME") != "" {
// zone = os.Getenv("TEST_ZONE_NAME")
// }
// fqdn = "cert-manager-dns01-tests-with-secret." + zone
if os.Getenv("TEST_ZONE_NAME") != "" {
zone = os.Getenv("TEST_ZONE_NAME")
}
fqdn = "cert-manager-dns01-tests-with-secret." + zone
testHandlerFunc := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
fmt.Println("called: ", httpCall)
fmt.Println("scenario:", scenarios[httpCall].scenario)
// assert.Equal(t, scenarios[httpCall].expected, req.URL.String(), scenarios[httpCall].scenario+" failed")
assert.Equal(t, scenarios[httpCall].expected, req.URL.String(), scenarios[httpCall].scenario+" failed")
httpCall++
w.Write([]byte(dnsResponse))
})