From aadf15487677d3d74960947c993e098c5b9ef54f Mon Sep 17 00:00:00 2001 From: Antoine Pultier <45740+fungiboletus@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:02:55 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=94=A7=20Some=20minor=20testing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 ++++++++++- main.go | 2 +- testdata/gandi/.gitignore | 1 + .../gandi/{config.json => api-key-config.json.sample} | 0 testdata/gandi/pat-config.json.sample | 6 ++++++ testdata/gandi/pat.yaml.sample | 7 +++++++ 6 files changed, 25 insertions(+), 2 deletions(-) rename testdata/gandi/{config.json => api-key-config.json.sample} (100%) create mode 100644 testdata/gandi/pat-config.json.sample create mode 100644 testdata/gandi/pat.yaml.sample diff --git a/README.md b/README.md index 54a4264b7..3793606ed 100644 --- a/README.md +++ b/README.md @@ -146,12 +146,21 @@ Please note that the test is not a typical unit or integration test. Instead it As said above, the conformance test is run against the real Gandi API. Therefore you *must* have a Gandi account, a domain and an API key. -``` shell +```shell +# With API key cp testdata/gandi/api-key.yaml.sample testdata/gandi/api-key.yaml +cp testdata/gandi/api-key-config.json.sample testdata/gandi/config.json echo -n $YOUR_GANDI_API_KEY | base64 | pbcopy # or xclip $EDITOR testdata/gandi/api-key.yaml +# With Personal Access Token (PAT) +cp testdata/gandi/pat.yaml.sample testdata/gandi/pat.yaml +cp testdata/gandi/pat-config.json.sample testdata/gandi/config.json +echo -n $YOUR_GANDI_PAT | base64 | pbcopy # or xclip +$EDITOR testdata/gandi/pat.yaml + TEST_ZONE_NAME=example.com. make test make clean + ``` [ACME DNS-01 challenge]: https://letsencrypt.org/docs/challenge-types/#dns-01-challenge diff --git a/main.go b/main.go index 3d57765a4..e8983cbec 100644 --- a/main.go +++ b/main.go @@ -174,7 +174,7 @@ func (c *gandiDNSProviderSolver) CleanUp(ch *v1alpha1.ChallengeRequest) error { _, err = gandiClient.GetDomainRecordByNameAndType(root, subdomain, "TXT") if err != nil { - klog.V(6).Infof("There is no entry of TXT matching, do nothing", subdomain+root, ch.Key) + klog.V(6).Infof("There is no entry of TXT matching, do nothing: %v", err) } else { err := gandiClient.DeleteDomainRecord(root, subdomain, "TXT") if err != nil { diff --git a/testdata/gandi/.gitignore b/testdata/gandi/.gitignore index d8414ed65..de88ce657 100644 --- a/testdata/gandi/.gitignore +++ b/testdata/gandi/.gitignore @@ -1 +1,2 @@ /api-key.yaml +/pat.yaml \ No newline at end of file diff --git a/testdata/gandi/config.json b/testdata/gandi/api-key-config.json.sample similarity index 100% rename from testdata/gandi/config.json rename to testdata/gandi/api-key-config.json.sample diff --git a/testdata/gandi/pat-config.json.sample b/testdata/gandi/pat-config.json.sample new file mode 100644 index 000000000..c219a8949 --- /dev/null +++ b/testdata/gandi/pat-config.json.sample @@ -0,0 +1,6 @@ +{ + "patSecretRef": { + "name": "gandi-pat", + "key": "pat" + } +} \ No newline at end of file diff --git a/testdata/gandi/pat.yaml.sample b/testdata/gandi/pat.yaml.sample new file mode 100644 index 000000000..3f8443088 --- /dev/null +++ b/testdata/gandi/pat.yaml.sample @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: gandi-pat +type: Opaque +data: + pat: