fix: test on CI (#2119)

This commit is contained in:
Ludovic Fernandez 2024-02-24 20:49:40 +01:00 committed by GitHub
parent fac40196c5
commit 9d0cd24533
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 51 additions and 51 deletions

View file

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
env:
GO_VERSION: stable
HUGO_VERSION: ${{vars.HUGO_VERSION}}
HUGO_VERSION: 0.117.0
CGO_ENABLED: 0
steps:

View file

@ -46,10 +46,10 @@ jobs:
golangci-lint --version
- name: Install Pebble
run: go install github.com/letsencrypt/pebble/v2/cmd/pebble@main
run: go install github.com/letsencrypt/pebble/v2/cmd/pebble@3fe019bbc0a41ed16e2fee31592bb91751acaa47
- name: Install challtestsrv
run: go install github.com/letsencrypt/pebble/v2/cmd/pebble-challtestsrv@main
run: go install github.com/letsencrypt/pebble/v2/cmd/pebble-challtestsrv@3fe019bbc0a41ed16e2fee31592bb91751acaa47
- name: Set up a Memcached server
uses: niden/actions-memcached@v7

View file

@ -14,13 +14,13 @@ func TestToFqdn(t *testing.T) {
}{
{
desc: "simple",
domain: "foo.bar.com",
expected: "foo.bar.com.",
domain: "foo.example.com",
expected: "foo.example.com.",
},
{
desc: "already FQDN",
domain: "foo.bar.com.",
expected: "foo.bar.com.",
domain: "foo.example.com.",
expected: "foo.example.com.",
},
}
@ -43,13 +43,13 @@ func TestUnFqdn(t *testing.T) {
}{
{
desc: "simple",
fqdn: "foo.bar.com.",
expected: "foo.bar.com",
fqdn: "foo.example.",
expected: "foo.example",
},
{
desc: "already domain",
fqdn: "foo.bar.com",
expected: "foo.bar.com",
fqdn: "foo.example",
expected: "foo.example",
},
}

View file

@ -382,62 +382,62 @@ func TestClient_AddTxtRecord(t *testing.T) {
{
desc: "sub-zone",
authID: "myAuthID",
zoneName: "bar.com",
authFQDN: "_acme-challenge.foo.bar.com.",
zoneName: "example.com",
authFQDN: "_acme-challenge.foo.example.com.",
value: "txtTXTtxtTXTtxtTXTtxtTXT",
ttl: 60,
apiResponse: `{"status":"Success","statusDescription":"The record was added successfully."}`,
expected: expected{
query: `auth-id=myAuthID&auth-password=myAuthPassword&domain-name=bar.com&host=_acme-challenge.foo&record=txtTXTtxtTXTtxtTXTtxtTXT&record-type=TXT&ttl=60`,
query: `auth-id=myAuthID&auth-password=myAuthPassword&domain-name=example.com&host=_acme-challenge.foo&record=txtTXTtxtTXTtxtTXTtxtTXT&record-type=TXT&ttl=60`,
},
},
{
desc: "main zone (authID)",
authID: "myAuthID",
zoneName: "bar.com",
authFQDN: "_acme-challenge.bar.com.",
zoneName: "example.com",
authFQDN: "_acme-challenge.example.com.",
value: "TXTtxtTXTtxtTXTtxtTXTtxt",
ttl: 60,
apiResponse: `{"status":"Success","statusDescription":"The record was added successfully."}`,
expected: expected{
query: `auth-id=myAuthID&auth-password=myAuthPassword&domain-name=bar.com&host=_acme-challenge&record=TXTtxtTXTtxtTXTtxtTXTtxt&record-type=TXT&ttl=60`,
query: `auth-id=myAuthID&auth-password=myAuthPassword&domain-name=example.com&host=_acme-challenge&record=TXTtxtTXTtxtTXTtxtTXTtxt&record-type=TXT&ttl=60`,
},
},
{
desc: "main zone (subAuthID)",
subAuthID: "mySubAuthID",
zoneName: "bar.com",
authFQDN: "_acme-challenge.bar.com.",
zoneName: "example.com",
authFQDN: "_acme-challenge.example.com.",
value: "TXTtxtTXTtxtTXTtxtTXTtxt",
ttl: 60,
apiResponse: `{"status":"Success","statusDescription":"The record was added successfully."}`,
expected: expected{
query: `auth-password=myAuthPassword&domain-name=bar.com&host=_acme-challenge&record=TXTtxtTXTtxtTXTtxtTXTtxt&record-type=TXT&sub-auth-id=mySubAuthID&ttl=60`,
query: `auth-password=myAuthPassword&domain-name=example.com&host=_acme-challenge&record=TXTtxtTXTtxtTXTtxtTXTtxt&record-type=TXT&sub-auth-id=mySubAuthID&ttl=60`,
},
},
{
desc: "invalid status",
authID: "myAuthID",
zoneName: "bar.com",
authFQDN: "_acme-challenge.bar.com.",
zoneName: "example.com",
authFQDN: "_acme-challenge.example.com.",
value: "TXTtxtTXTtxtTXTtxtTXTtxt",
ttl: 120,
apiResponse: `{"status":"Failed","statusDescription":"Invalid TTL. Choose from the list of the values we support."}`,
expected: expected{
query: `auth-id=myAuthID&auth-password=myAuthPassword&domain-name=bar.com&host=_acme-challenge&record=TXTtxtTXTtxtTXTtxtTXTtxt&record-type=TXT&ttl=300`,
query: `auth-id=myAuthID&auth-password=myAuthPassword&domain-name=example.com&host=_acme-challenge&record=TXTtxtTXTtxtTXTtxtTXTtxt&record-type=TXT&ttl=300`,
errorMsg: "failed to add TXT record: Failed Invalid TTL. Choose from the list of the values we support.",
},
},
{
desc: "invalid json response",
authID: "myAuthID",
zoneName: "bar.com",
authFQDN: "_acme-challenge.bar.com.",
zoneName: "example.com",
authFQDN: "_acme-challenge.example.com.",
value: "TXTtxtTXTtxtTXTtxtTXTtxt",
ttl: 120,
apiResponse: `[{}]`,
expected: expected{
query: `auth-id=myAuthID&auth-password=myAuthPassword&domain-name=bar.com&host=_acme-challenge&record=TXTtxtTXTtxtTXTtxtTXTtxt&record-type=TXT&ttl=300`,
query: `auth-id=myAuthID&auth-password=myAuthPassword&domain-name=example.com&host=_acme-challenge&record=TXTtxtTXTtxtTXTtxtTXTtxt&record-type=TXT&ttl=300`,
errorMsg: "unable to unmarshal response: [status code: 200] body: [{}] error: json: cannot unmarshal array into Go value of type internal.apiResponse",
},
},

View file

@ -81,23 +81,23 @@ func TestClient_GetDomainInformation(t *testing.T) {
}{
{
desc: "domain found",
fqdn: "_acme-challenge.foo.com.",
fqdn: "_acme-challenge.example.org.",
response: &apiResponse{
Code: 1,
},
data: []Data{
{
ID: "1",
Domain: "bar.com.",
Domain: "example.com.",
},
{
ID: "2",
Domain: "foo.com.",
Domain: "example.org.",
},
},
expected: result{domain: &Data{
ID: "2",
Domain: "foo.com.",
Domain: "example.org.",
}},
},
{
@ -109,11 +109,11 @@ func TestClient_GetDomainInformation(t *testing.T) {
data: []Data{
{
ID: "5",
Domain: "bar.com.",
Domain: "example.com.",
},
{
ID: "6",
Domain: "foo.com.",
Domain: "example.org.",
},
},
expected: result{error: true},
@ -152,13 +152,13 @@ func TestClient_FindTxtRecord(t *testing.T) {
}{
{
desc: "record found",
fqdn: "_acme-challenge.foo.com.",
fqdn: "_acme-challenge.example.org.",
zoneID: "test-zone",
txtRecords: []TXTRecord{
{
ID: 1,
RecordID: "Record-A",
Host: "_acme-challenge.foo.com",
Host: "_acme-challenge.example.org",
Value: "txtTXTtxtTXTtxtTXTtxtTXT",
Type: "TXT",
LineID: 6,
@ -167,7 +167,7 @@ func TestClient_FindTxtRecord(t *testing.T) {
{
ID: 2,
RecordID: "Record-B",
Host: "_acme-challenge.bar.com",
Host: "_acme-challenge.example.com",
Value: "TXTtxtTXTtxtTXTtxtTXTtxt",
Type: "TXT",
LineID: 6,
@ -181,7 +181,7 @@ func TestClient_FindTxtRecord(t *testing.T) {
txtRecord: &TXTRecord{
ID: 1,
RecordID: "Record-A",
Host: "_acme-challenge.foo.com",
Host: "_acme-challenge.example.org",
Value: "txtTXTtxtTXTtxtTXTtxtTXT",
Type: "TXT",
LineID: 6,
@ -197,7 +197,7 @@ func TestClient_FindTxtRecord(t *testing.T) {
{
ID: 1,
RecordID: "Record-A",
Host: "_acme-challenge.foo.com",
Host: "_acme-challenge.example.org",
Value: "txtTXTtxtTXTtxtTXTtxtTXT",
Type: "TXT",
LineID: 6,
@ -206,7 +206,7 @@ func TestClient_FindTxtRecord(t *testing.T) {
{
ID: 2,
RecordID: "Record-B",
Host: "_acme-challenge.bar.com",
Host: "_acme-challenge.example.com",
Value: "TXTtxtTXTtxtTXTtxtTXTtxt",
Type: "TXT",
LineID: 6,
@ -249,9 +249,9 @@ func TestClient_AddTxtRecord(t *testing.T) {
desc: "sub-domain",
domain: &Data{
ID: "1",
Domain: "bar.com.",
Domain: "example.com.",
},
fqdn: "_acme-challenge.foo.bar.com.",
fqdn: "_acme-challenge.foo.example.com.",
value: "txtTXTtxtTXTtxtTXTtxtTXT",
ttl: 30,
expected: `{"domain_id":1,"host":"_acme-challenge.foo","value":"txtTXTtxtTXTtxtTXTtxtTXT","type":"TXT","line_id":"1","ttl":"30"}`,
@ -260,9 +260,9 @@ func TestClient_AddTxtRecord(t *testing.T) {
desc: "main domain",
domain: &Data{
ID: "2",
Domain: "bar.com.",
Domain: "example.com.",
},
fqdn: "_acme-challenge.bar.com.",
fqdn: "_acme-challenge.example.com.",
value: "TXTtxtTXTtxtTXTtxtTXTtxt",
ttl: 30,
expected: `{"domain_id":2,"host":"_acme-challenge","value":"TXTtxtTXTtxtTXTtxtTXTtxt","type":"TXT","line_id":"1","ttl":"30"}`,

View file

@ -158,13 +158,13 @@ func TestDNSProvider_findZone(t *testing.T) {
}{
{
desc: "Extract root record name",
domain: "bar.com.",
expected: "bar.com",
domain: "example.com.",
expected: "example.com",
},
{
desc: "Extract sub record name",
domain: "foo.bar.com.",
expected: "bar.com",
domain: "foo.example.com.",
expected: "example.com",
},
}

View file

@ -144,17 +144,17 @@ func TestDNSProvider_FindZoneAndRecordName(t *testing.T) {
}{
{
desc: "Extract root record name",
fqdn: "_acme-challenge.bar.com.",
fqdn: "_acme-challenge.example.com.",
expected: expected{
zone: "bar.com",
zone: "example.com",
recordName: "_acme-challenge",
},
},
{
desc: "Extract sub record name",
fqdn: "_acme-challenge.foo.bar.com.",
fqdn: "_acme-challenge.foo.example.com.",
expected: expected{
zone: "bar.com",
zone: "example.com",
recordName: "_acme-challenge.foo",
},
},

View file

@ -197,7 +197,7 @@ func TestDNSProvider_Present(t *testing.T) {
Page: 1,
},
Data: []linodego.Domain{{
Domain: "foobar.com",
Domain: "example.com",
ID: 1234,
}},
},