Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4bac6da43 | ||
|
|
53392dd472 | ||
|
|
4566e746f3 | ||
|
|
08895200bb | ||
|
|
809e5068d7 |
No files matched your search
@@ -1,15 +0,0 @@
|
|||||||
ignore:
|
|
||||||
- "storage/store/sql/specific_postgres.go" # Can't test for postgres
|
|
||||||
- "watchdog/endpoint.go"
|
|
||||||
- "watchdog/external_endpoint.go"
|
|
||||||
- "watchdog/suite.go"
|
|
||||||
- "watchdog/watchdog.go"
|
|
||||||
comment: false
|
|
||||||
coverage:
|
|
||||||
status:
|
|
||||||
patch: off
|
|
||||||
project:
|
|
||||||
default:
|
|
||||||
target: 70%
|
|
||||||
threshold: null
|
|
||||||
|
|
||||||
@@ -20,11 +20,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: 1.26.3
|
go-version: 1.26.3
|
||||||
repository: "${{ github.event.inputs.repository || 'TwiN/gatus' }}"
|
repository: "${{ github.event.inputs.repository || 'TwiN/gatus' }}"
|
||||||
ref: "${{ github.event.inputs.ref || 'master' }}"
|
ref: "${{ github.event.inputs.ref || 'master' }}"
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v7
|
||||||
- name: Benchmark
|
- name: Benchmark
|
||||||
run: go test -bench=. ./storage/store
|
run: go test -bench=. ./storage/store
|
||||||
@@ -19,7 +19,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v7
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v4
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v7
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v4
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
if: ${{ (github.event.workflow_run.conclusion == 'success') && (github.event.workflow_run.head_repository.full_name == github.repository) }}
|
if: ${{ (github.event.workflow_run.conclusion == 'success') && (github.event.workflow_run.head_repository.full_name == github.repository) }}
|
||||||
timeout-minutes: 240
|
timeout-minutes: 240
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v7
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v4
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 240
|
timeout-minutes: 240
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v7
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v4
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
core.setOutput('ref', pr.data.head.ref);
|
core.setOutput('ref', pr.data.head.ref);
|
||||||
core.setOutput('repo', pr.data.head.repo.full_name);
|
core.setOutput('repo', pr.data.head.repo.full_name);
|
||||||
- name: Checkout PR branch
|
- name: Checkout PR branch
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
repository: ${{ steps.pr.outputs.repo }}
|
repository: ${{ steps.pr.outputs.repo }}
|
||||||
ref: ${{ steps.pr.outputs.ref }}
|
ref: ${{ steps.pr.outputs.ref }}
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v7
|
||||||
- run: make frontend-install
|
- run: make frontend-install
|
||||||
- run: make frontend-build
|
- run: make frontend-build
|
||||||
@@ -16,19 +16,14 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-go@v6
|
- uses: actions/setup-go@v7
|
||||||
with:
|
with:
|
||||||
go-version: 1.26.3
|
go-version: 1.26.3
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v7
|
||||||
- name: Build binary to make sure it works
|
- name: Build binary to make sure it works
|
||||||
run: go build
|
run: go build
|
||||||
- name: Test
|
- name: Test
|
||||||
# We're using "sudo" because one of the tests leverages ping, which requires super-user privileges.
|
# We're using "sudo" because one of the tests leverages ping, which requires super-user privileges.
|
||||||
# As for the 'env "PATH=$PATH" "GOROOT=$GOROOT"', we need it to use the same "go" executable that
|
# As for the 'env "PATH=$PATH" "GOROOT=$GOROOT"', we need it to use the same "go" executable that
|
||||||
# was configured by the "Set up Go" step (otherwise, it'd use sudo's "go" executable)
|
# was configured by the "Set up Go" step (otherwise, it'd use sudo's "go" executable)
|
||||||
run: sudo env "PATH=$PATH" "GOROOT=$GOROOT" go test ./... -race -coverprofile=coverage.txt -covermode=atomic
|
run: sudo env "PATH=$PATH" "GOROOT=$GOROOT" go test ./... -race
|
||||||
- name: Codecov
|
|
||||||
uses: codecov/codecov-action@v6.0.1
|
|
||||||
with:
|
|
||||||
files: ./coverage.txt
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||

|

|
||||||
[](https://goreportcard.com/report/github.com/TwiN/gatus)
|
[](https://goreportcard.com/report/github.com/TwiN/gatus)
|
||||||
[](https://codecov.io/gh/TwiN/gatus)
|
|
||||||
[](https://github.com/TwiN/gatus)
|
[](https://github.com/TwiN/gatus)
|
||||||
[](https://cloud.docker.com/repository/docker/twinproduction/gatus)
|
[](https://cloud.docker.com/repository/docker/twinproduction/gatus)
|
||||||
[](https://github.com/TwiN)
|
[](https://github.com/TwiN)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ func isIgnorableTestError(err error) bool {
|
|||||||
return strings.Contains(errStr, "user does not exist") ||
|
return strings.Contains(errStr, "user does not exist") ||
|
||||||
strings.Contains(errStr, "no such host") ||
|
strings.Contains(errStr, "no such host") ||
|
||||||
strings.Contains(errStr, "invalid username, password or token") ||
|
strings.Contains(errStr, "invalid username, password or token") ||
|
||||||
|
strings.Contains(errStr, "unknown API error") ||
|
||||||
strings.Contains(errStr, "dial tcp")
|
strings.Contains(errStr, "dial tcp")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -499,6 +499,13 @@ func QueryDNS(queryType, queryName, url string) (connected bool, dnsRcode string
|
|||||||
if srv, ok := rr.(*dns.SRV); ok {
|
if srv, ok := rr.(*dns.SRV); ok {
|
||||||
body = []byte(fmt.Sprintf("%s:%d", srv.Target, srv.Port))
|
body = []byte(fmt.Sprintf("%s:%d", srv.Target, srv.Port))
|
||||||
}
|
}
|
||||||
|
case dns.TypeTXT:
|
||||||
|
if txt, ok := rr.(*dns.TXT); ok {
|
||||||
|
if len(body) > 0 {
|
||||||
|
body = append(body, '\n')
|
||||||
|
}
|
||||||
|
body = append(body, []byte(strings.Join(txt.Txt, ""))...)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
body = []byte("query type is not supported yet")
|
body = []byte("query type is not supported yet")
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-2
@@ -8,6 +8,7 @@ import (
|
|||||||
"net/netip"
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -16,6 +17,17 @@ import (
|
|||||||
"github.com/TwiN/gatus/v5/test"
|
"github.com/TwiN/gatus/v5/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func isIgnorableNetworkTestError(err error) bool {
|
||||||
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
errString := err.Error()
|
||||||
|
return strings.Contains(errString, "no such host") ||
|
||||||
|
strings.Contains(errString, "connection reset by peer") ||
|
||||||
|
strings.Contains(errString, "i/o timeout") ||
|
||||||
|
strings.Contains(errString, "server misbehaving")
|
||||||
|
}
|
||||||
|
|
||||||
func TestGetHTTPClient(t *testing.T) {
|
func TestGetHTTPClient(t *testing.T) {
|
||||||
cfg := &Config{
|
cfg := &Config{
|
||||||
Insecure: false,
|
Insecure: false,
|
||||||
@@ -221,6 +233,9 @@ func TestCanPerformStartTLS(t *testing.T) {
|
|||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
connected, _, err := CanPerformStartTLS(tt.args.address, &Config{Insecure: tt.args.insecure, Timeout: 5 * time.Second, DNSResolver: tt.args.dnsresolver})
|
connected, _, err := CanPerformStartTLS(tt.args.address, &Config{Insecure: tt.args.insecure, Timeout: 5 * time.Second, DNSResolver: tt.args.dnsresolver})
|
||||||
|
if !tt.wantErr && isIgnorableNetworkTestError(err) {
|
||||||
|
t.Skipf("skipping due to transient network error: %v", err)
|
||||||
|
}
|
||||||
if (err != nil) != tt.wantErr {
|
if (err != nil) != tt.wantErr {
|
||||||
t.Errorf("CanPerformStartTLS() err=%v, wantErr=%v", err, tt.wantErr)
|
t.Errorf("CanPerformStartTLS() err=%v, wantErr=%v", err, tt.wantErr)
|
||||||
return
|
return
|
||||||
@@ -290,6 +305,9 @@ func TestCanPerformTLS(t *testing.T) {
|
|||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
connected, _, _, err := CanPerformTLS(tt.args.address, "", &Config{Insecure: tt.args.insecure, Timeout: 5 * time.Second})
|
connected, _, _, err := CanPerformTLS(tt.args.address, "", &Config{Insecure: tt.args.insecure, Timeout: 5 * time.Second})
|
||||||
|
if !tt.wantErr && isIgnorableNetworkTestError(err) {
|
||||||
|
t.Skipf("skipping due to transient network error: %v", err)
|
||||||
|
}
|
||||||
if (err != nil) != tt.wantErr {
|
if (err != nil) != tt.wantErr {
|
||||||
t.Errorf("CanPerformTLS() err=%v, wantErr=%v", err, tt.wantErr)
|
t.Errorf("CanPerformTLS() err=%v, wantErr=%v", err, tt.wantErr)
|
||||||
return
|
return
|
||||||
@@ -507,6 +525,16 @@ func TestQueryDNS(t *testing.T) {
|
|||||||
expectedDNSCode: "NOERROR",
|
expectedDNSCode: "NOERROR",
|
||||||
expectedBody: "one.one.one.one.",
|
expectedBody: "one.one.one.one.",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "test Config with type TXT",
|
||||||
|
inputDNS: dns.Config{
|
||||||
|
QueryType: "TXT",
|
||||||
|
QueryName: "example.com.",
|
||||||
|
},
|
||||||
|
inputURL: "1.1.1.1",
|
||||||
|
expectedDNSCode: "NOERROR",
|
||||||
|
expectedBody: "*v=spf1*",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "test Config with fake type and retrieve error",
|
name: "test Config with fake type and retrieve error",
|
||||||
inputDNS: dns.Config{
|
inputDNS: dns.Config{
|
||||||
@@ -526,8 +554,8 @@ func TestQueryDNS(t *testing.T) {
|
|||||||
if dnsRCode != scenario.expectedDNSCode {
|
if dnsRCode != scenario.expectedDNSCode {
|
||||||
t.Errorf("expected DNSRCode to be %s, got %s", scenario.expectedDNSCode, dnsRCode)
|
t.Errorf("expected DNSRCode to be %s, got %s", scenario.expectedDNSCode, dnsRCode)
|
||||||
}
|
}
|
||||||
if scenario.inputDNS.QueryType == "NS" {
|
if scenario.inputDNS.QueryType == "NS" || scenario.inputDNS.QueryType == "TXT" {
|
||||||
// Because there are often multiple nameservers backing a single domain, we'll only look at the suffix
|
// Some record types can have multiple valid answers, so wildcard matching is used in those scenarios
|
||||||
if !pattern.Match(scenario.expectedBody, string(body)) {
|
if !pattern.Match(scenario.expectedBody, string(body)) {
|
||||||
t.Errorf("got %s, expected result %s,", string(body), scenario.expectedBody)
|
t.Errorf("got %s, expected result %s,", string(body), scenario.expectedBody)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ require (
|
|||||||
github.com/registrobr/rdap v1.1.8
|
github.com/registrobr/rdap v1.1.8
|
||||||
github.com/valyala/fasthttp v1.71.0
|
github.com/valyala/fasthttp v1.71.0
|
||||||
github.com/wcharczuk/go-chart/v2 v2.1.2
|
github.com/wcharczuk/go-chart/v2 v2.1.2
|
||||||
golang.org/x/crypto v0.51.0
|
golang.org/x/crypto v0.52.0
|
||||||
golang.org/x/oauth2 v0.36.0
|
golang.org/x/oauth2 v0.36.0
|
||||||
golang.org/x/sync v0.20.0
|
golang.org/x/sync v0.20.0
|
||||||
google.golang.org/api v0.280.0
|
google.golang.org/api v0.280.0
|
||||||
@@ -91,7 +91,7 @@ require (
|
|||||||
golang.org/x/image v0.40.0 // indirect
|
golang.org/x/image v0.40.0 // indirect
|
||||||
golang.org/x/mod v0.36.0 // indirect
|
golang.org/x/mod v0.36.0 // indirect
|
||||||
golang.org/x/net v0.54.0 // indirect
|
golang.org/x/net v0.54.0 // indirect
|
||||||
golang.org/x/sys v0.44.0 // indirect
|
golang.org/x/sys v0.45.0 // indirect
|
||||||
golang.org/x/text v0.37.0 // indirect
|
golang.org/x/text v0.37.0 // indirect
|
||||||
golang.org/x/tools v0.45.0 // indirect
|
golang.org/x/tools v0.45.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260519071638-aa98bba5eb94 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260519071638-aa98bba5eb94 // indirect
|
||||||
|
|||||||
@@ -188,8 +188,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
|
|||||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||||
golang.org/x/crypto v0.51.0 h1:IBPXwPfKxY7cWQZ38ZCIRPI50YLeevDLlLnyC5wRGTI=
|
golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988=
|
||||||
golang.org/x/crypto v0.51.0/go.mod h1:8AdwkbraGNABw2kOX6YFPs3WM22XqI4EXEd8g+x7Oc8=
|
golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc=
|
||||||
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
|
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
|
||||||
golang.org/x/image v0.40.0 h1:Tw4GyDXMo+daZN1znreBRC3VayR1aLFUyUEOLUdW1a8=
|
golang.org/x/image v0.40.0 h1:Tw4GyDXMo+daZN1znreBRC3VayR1aLFUyUEOLUdW1a8=
|
||||||
golang.org/x/image v0.40.0/go.mod h1:uIc348UZMSvS5Z65CVZ7iDPaNobNFEPeJ4kbqTOszmA=
|
golang.org/x/image v0.40.0/go.mod h1:uIc348UZMSvS5Z65CVZ7iDPaNobNFEPeJ4kbqTOszmA=
|
||||||
@@ -232,8 +232,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.44.0 h1:ildZl3J4uzeKP07r2F++Op7E9B29JRUy+a27EibtBTQ=
|
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
|
||||||
golang.org/x/sys v0.44.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
|
|||||||
Reference in new issue
Block a user