Skip to content

Commit

Permalink
feat: 🔧 Some minor testing
Browse files Browse the repository at this point in the history
  • Loading branch information
fungiboletus committed Sep 16, 2024
1 parent 71bf7ea commit aadf154
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions testdata/gandi/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/api-key.yaml
/pat.yaml
File renamed without changes.
6 changes: 6 additions & 0 deletions testdata/gandi/pat-config.json.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"patSecretRef": {
"name": "gandi-pat",
"key": "pat"
}
}
7 changes: 7 additions & 0 deletions testdata/gandi/pat.yaml.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: gandi-pat
type: Opaque
data:
pat: <BASE64 PERSONAL ACCESS TOKEN>

0 comments on commit aadf154

Please sign in to comment.