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 runs-on: ubuntu-latest
env: env:
GO_VERSION: stable GO_VERSION: stable
HUGO_VERSION: ${{vars.HUGO_VERSION}} HUGO_VERSION: 0.117.0
CGO_ENABLED: 0 CGO_ENABLED: 0
steps: steps:

View file

@ -46,10 +46,10 @@ jobs:
golangci-lint --version golangci-lint --version
- name: Install Pebble - 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 - 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 - name: Set up a Memcached server
uses: niden/actions-memcached@v7 uses: niden/actions-memcached@v7

View file

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

View file

@ -382,62 +382,62 @@ func TestClient_AddTxtRecord(t *testing.T) {
{ {
desc: "sub-zone", desc: "sub-zone",
authID: "myAuthID", authID: "myAuthID",
zoneName: "bar.com", zoneName: "example.com",
authFQDN: "_acme-challenge.foo.bar.com.", authFQDN: "_acme-challenge.foo.example.com.",
value: "txtTXTtxtTXTtxtTXTtxtTXT", value: "txtTXTtxtTXTtxtTXTtxtTXT",
ttl: 60, ttl: 60,
apiResponse: `{"status":"Success","statusDescription":"The record was added successfully."}`, apiResponse: `{"status":"Success","statusDescription":"The record was added successfully."}`,
expected: expected{ 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)", desc: "main zone (authID)",
authID: "myAuthID", authID: "myAuthID",
zoneName: "bar.com", zoneName: "example.com",
authFQDN: "_acme-challenge.bar.com.", authFQDN: "_acme-challenge.example.com.",
value: "TXTtxtTXTtxtTXTtxtTXTtxt", value: "TXTtxtTXTtxtTXTtxtTXTtxt",
ttl: 60, ttl: 60,
apiResponse: `{"status":"Success","statusDescription":"The record was added successfully."}`, apiResponse: `{"status":"Success","statusDescription":"The record was added successfully."}`,
expected: expected{ 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)", desc: "main zone (subAuthID)",
subAuthID: "mySubAuthID", subAuthID: "mySubAuthID",
zoneName: "bar.com", zoneName: "example.com",
authFQDN: "_acme-challenge.bar.com.", authFQDN: "_acme-challenge.example.com.",
value: "TXTtxtTXTtxtTXTtxtTXTtxt", value: "TXTtxtTXTtxtTXTtxtTXTtxt",
ttl: 60, ttl: 60,
apiResponse: `{"status":"Success","statusDescription":"The record was added successfully."}`, apiResponse: `{"status":"Success","statusDescription":"The record was added successfully."}`,
expected: expected{ 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", desc: "invalid status",
authID: "myAuthID", authID: "myAuthID",
zoneName: "bar.com", zoneName: "example.com",
authFQDN: "_acme-challenge.bar.com.", authFQDN: "_acme-challenge.example.com.",
value: "TXTtxtTXTtxtTXTtxtTXTtxt", value: "TXTtxtTXTtxtTXTtxtTXTtxt",
ttl: 120, ttl: 120,
apiResponse: `{"status":"Failed","statusDescription":"Invalid TTL. Choose from the list of the values we support."}`, apiResponse: `{"status":"Failed","statusDescription":"Invalid TTL. Choose from the list of the values we support."}`,
expected: expected{ 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.", errorMsg: "failed to add TXT record: Failed Invalid TTL. Choose from the list of the values we support.",
}, },
}, },
{ {
desc: "invalid json response", desc: "invalid json response",
authID: "myAuthID", authID: "myAuthID",
zoneName: "bar.com", zoneName: "example.com",
authFQDN: "_acme-challenge.bar.com.", authFQDN: "_acme-challenge.example.com.",
value: "TXTtxtTXTtxtTXTtxtTXTtxt", value: "TXTtxtTXTtxtTXTtxtTXTtxt",
ttl: 120, ttl: 120,
apiResponse: `[{}]`, apiResponse: `[{}]`,
expected: expected{ 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", 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", desc: "domain found",
fqdn: "_acme-challenge.foo.com.", fqdn: "_acme-challenge.example.org.",
response: &apiResponse{ response: &apiResponse{
Code: 1, Code: 1,
}, },
data: []Data{ data: []Data{
{ {
ID: "1", ID: "1",
Domain: "bar.com.", Domain: "example.com.",
}, },
{ {
ID: "2", ID: "2",
Domain: "foo.com.", Domain: "example.org.",
}, },
}, },
expected: result{domain: &Data{ expected: result{domain: &Data{
ID: "2", ID: "2",
Domain: "foo.com.", Domain: "example.org.",
}}, }},
}, },
{ {
@ -109,11 +109,11 @@ func TestClient_GetDomainInformation(t *testing.T) {
data: []Data{ data: []Data{
{ {
ID: "5", ID: "5",
Domain: "bar.com.", Domain: "example.com.",
}, },
{ {
ID: "6", ID: "6",
Domain: "foo.com.", Domain: "example.org.",
}, },
}, },
expected: result{error: true}, expected: result{error: true},
@ -152,13 +152,13 @@ func TestClient_FindTxtRecord(t *testing.T) {
}{ }{
{ {
desc: "record found", desc: "record found",
fqdn: "_acme-challenge.foo.com.", fqdn: "_acme-challenge.example.org.",
zoneID: "test-zone", zoneID: "test-zone",
txtRecords: []TXTRecord{ txtRecords: []TXTRecord{
{ {
ID: 1, ID: 1,
RecordID: "Record-A", RecordID: "Record-A",
Host: "_acme-challenge.foo.com", Host: "_acme-challenge.example.org",
Value: "txtTXTtxtTXTtxtTXTtxtTXT", Value: "txtTXTtxtTXTtxtTXTtxtTXT",
Type: "TXT", Type: "TXT",
LineID: 6, LineID: 6,
@ -167,7 +167,7 @@ func TestClient_FindTxtRecord(t *testing.T) {
{ {
ID: 2, ID: 2,
RecordID: "Record-B", RecordID: "Record-B",
Host: "_acme-challenge.bar.com", Host: "_acme-challenge.example.com",
Value: "TXTtxtTXTtxtTXTtxtTXTtxt", Value: "TXTtxtTXTtxtTXTtxtTXTtxt",
Type: "TXT", Type: "TXT",
LineID: 6, LineID: 6,
@ -181,7 +181,7 @@ func TestClient_FindTxtRecord(t *testing.T) {
txtRecord: &TXTRecord{ txtRecord: &TXTRecord{
ID: 1, ID: 1,
RecordID: "Record-A", RecordID: "Record-A",
Host: "_acme-challenge.foo.com", Host: "_acme-challenge.example.org",
Value: "txtTXTtxtTXTtxtTXTtxtTXT", Value: "txtTXTtxtTXTtxtTXTtxtTXT",
Type: "TXT", Type: "TXT",
LineID: 6, LineID: 6,
@ -197,7 +197,7 @@ func TestClient_FindTxtRecord(t *testing.T) {
{ {
ID: 1, ID: 1,
RecordID: "Record-A", RecordID: "Record-A",
Host: "_acme-challenge.foo.com", Host: "_acme-challenge.example.org",
Value: "txtTXTtxtTXTtxtTXTtxtTXT", Value: "txtTXTtxtTXTtxtTXTtxtTXT",
Type: "TXT", Type: "TXT",
LineID: 6, LineID: 6,
@ -206,7 +206,7 @@ func TestClient_FindTxtRecord(t *testing.T) {
{ {
ID: 2, ID: 2,
RecordID: "Record-B", RecordID: "Record-B",
Host: "_acme-challenge.bar.com", Host: "_acme-challenge.example.com",
Value: "TXTtxtTXTtxtTXTtxtTXTtxt", Value: "TXTtxtTXTtxtTXTtxtTXTtxt",
Type: "TXT", Type: "TXT",
LineID: 6, LineID: 6,
@ -249,9 +249,9 @@ func TestClient_AddTxtRecord(t *testing.T) {
desc: "sub-domain", desc: "sub-domain",
domain: &Data{ domain: &Data{
ID: "1", ID: "1",
Domain: "bar.com.", Domain: "example.com.",
}, },
fqdn: "_acme-challenge.foo.bar.com.", fqdn: "_acme-challenge.foo.example.com.",
value: "txtTXTtxtTXTtxtTXTtxtTXT", value: "txtTXTtxtTXTtxtTXTtxtTXT",
ttl: 30, ttl: 30,
expected: `{"domain_id":1,"host":"_acme-challenge.foo","value":"txtTXTtxtTXTtxtTXTtxtTXT","type":"TXT","line_id":"1","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", desc: "main domain",
domain: &Data{ domain: &Data{
ID: "2", ID: "2",
Domain: "bar.com.", Domain: "example.com.",
}, },
fqdn: "_acme-challenge.bar.com.", fqdn: "_acme-challenge.example.com.",
value: "TXTtxtTXTtxtTXTtxtTXTtxt", value: "TXTtxtTXTtxtTXTtxtTXTtxt",
ttl: 30, ttl: 30,
expected: `{"domain_id":2,"host":"_acme-challenge","value":"TXTtxtTXTtxtTXTtxtTXTtxt","type":"TXT","line_id":"1","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", desc: "Extract root record name",
domain: "bar.com.", domain: "example.com.",
expected: "bar.com", expected: "example.com",
}, },
{ {
desc: "Extract sub record name", desc: "Extract sub record name",
domain: "foo.bar.com.", domain: "foo.example.com.",
expected: "bar.com", expected: "example.com",
}, },
} }

View file

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

View file

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