mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-28 19:03:24 +01:00
Minor updates
This commit is contained in:
parent
d3805cd77a
commit
08aba6cd51
17
README.md
17
README.md
@ -235,12 +235,17 @@ Here are some examples of conditions you can use:
|
|||||||
| Parameter | Description | Default |
|
| Parameter | Description | Default |
|
||||||
|:------------------ |:-------------------------------------------------------------------------------------- |:-------------- |
|
|:------------------ |:-------------------------------------------------------------------------------------- |:-------------- |
|
||||||
| `storage` | Storage configuration | `{}` |
|
| `storage` | Storage configuration | `{}` |
|
||||||
| `storage.file` | Path to persist the data in. If the type is `memory`, data is persisted on interval. | `""` |
|
| `storage.path` | Path to persist the data in. Only supported for types `sqlite` and `postgres`. | `""` |
|
||||||
| `storage.type` | Type of storage. Valid types: `memory`, `sqlite`, `postgres` (ALPHA). | `"memory"` |
|
| `storage.type` | Type of storage. Valid types: `memory`, `sqlite`, `postgres`. | `"memory"` |
|
||||||
|
|
||||||
- If `storage.type` is `memory` (default) and `storage.file` is set to a non-blank value.
|
- If `storage.type` is `memory` (default):
|
||||||
Furthermore, the data is periodically persisted, but everything remains in memory.
|
```yaml
|
||||||
- If `storage.type` is `sqlite`, `storage.file` must not be blank:
|
# Note that this is the default value, and you can omit the storage configuration altogether to achieve the same result.
|
||||||
|
# Because the data is stored in memory, the data will not survive a restart.
|
||||||
|
storage:
|
||||||
|
type: memory
|
||||||
|
```
|
||||||
|
- If `storage.type` is `sqlite`, `storage.path` must not be blank:
|
||||||
```yaml
|
```yaml
|
||||||
storage:
|
storage:
|
||||||
type: sqlite
|
type: sqlite
|
||||||
@ -248,7 +253,7 @@ storage:
|
|||||||
```
|
```
|
||||||
See [examples/docker-compose-sqlite-storage](.examples/docker-compose-sqlite-storage) for an example.
|
See [examples/docker-compose-sqlite-storage](.examples/docker-compose-sqlite-storage) for an example.
|
||||||
|
|
||||||
- If `storage.type` is `postgres`, `storage.file` must be the connection URL:
|
- If `storage.type` is `postgres`, `storage.path` must be the connection URL:
|
||||||
```yaml
|
```yaml
|
||||||
storage:
|
storage:
|
||||||
type: postgres
|
type: postgres
|
||||||
|
@ -169,8 +169,8 @@ func TestStore_InsertCleansUpEventsAndResultsProperly(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStore_Persistence(t *testing.T) {
|
func TestStore_Persistence(t *testing.T) {
|
||||||
file := t.TempDir() + "/TestStore_Persistence.db"
|
path := t.TempDir() + "/TestStore_Persistence.db"
|
||||||
store, _ := NewStore("sqlite", file)
|
store, _ := NewStore("sqlite", path)
|
||||||
store.Insert(&testEndpoint, &testSuccessfulResult)
|
store.Insert(&testEndpoint, &testSuccessfulResult)
|
||||||
store.Insert(&testEndpoint, &testUnsuccessfulResult)
|
store.Insert(&testEndpoint, &testUnsuccessfulResult)
|
||||||
if uptime, _ := store.GetUptimeByKey(testEndpoint.Key(), time.Now().Add(-time.Hour), time.Now()); uptime != 0.5 {
|
if uptime, _ := store.GetUptimeByKey(testEndpoint.Key(), time.Now().Add(-time.Hour), time.Now()); uptime != 0.5 {
|
||||||
@ -188,7 +188,7 @@ func TestStore_Persistence(t *testing.T) {
|
|||||||
t.Fatal("sanity check failed")
|
t.Fatal("sanity check failed")
|
||||||
}
|
}
|
||||||
store.Close()
|
store.Close()
|
||||||
store, _ = NewStore("sqlite", file)
|
store, _ = NewStore("sqlite", path)
|
||||||
defer store.Close()
|
defer store.Close()
|
||||||
ssFromNewStore, _ := store.GetEndpointStatus(testEndpoint.Group, testEndpoint.Name, paging.NewEndpointStatusParams().WithResults(1, common.MaximumNumberOfResults).WithEvents(1, common.MaximumNumberOfEvents))
|
ssFromNewStore, _ := store.GetEndpointStatus(testEndpoint.Group, testEndpoint.Name, paging.NewEndpointStatusParams().WithResults(1, common.MaximumNumberOfResults).WithEvents(1, common.MaximumNumberOfEvents))
|
||||||
if ssFromNewStore == nil || ssFromNewStore.Group != "group" || ssFromNewStore.Name != "name" || len(ssFromNewStore.Events) != 3 || len(ssFromNewStore.Results) != 2 {
|
if ssFromNewStore == nil || ssFromNewStore.Group != "group" || ssFromNewStore.Name != "name" || len(ssFromNewStore.Events) != 3 || len(ssFromNewStore.Results) != 2 {
|
||||||
|
@ -547,23 +547,23 @@ func TestInitialize(t *testing.T) {
|
|||||||
ExpectedErr: nil,
|
ExpectedErr: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "memory-no-file",
|
Name: "memory-no-path",
|
||||||
Cfg: &storage.Config{Type: storage.TypeMemory},
|
Cfg: &storage.Config{Type: storage.TypeMemory},
|
||||||
ExpectedErr: nil,
|
ExpectedErr: nil,
|
||||||
},
|
},
|
||||||
{
|
{ // XXX: Remove for v4.0.0. See https://github.com/TwiN/gatus/issues/198
|
||||||
Name: "memory-with-file",
|
Name: "memory-with-path",
|
||||||
Cfg: &storage.Config{Type: storage.TypeMemory, Path: t.TempDir() + "/TestInitialize_memory-with-file.db"},
|
Cfg: &storage.Config{Type: storage.TypeMemory, Path: t.TempDir() + "/TestInitialize_memory-with-path.db"},
|
||||||
ExpectedErr: nil,
|
ExpectedErr: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "sqlite-no-file",
|
Name: "sqlite-no-path",
|
||||||
Cfg: &storage.Config{Type: storage.TypeSQLite},
|
Cfg: &storage.Config{Type: storage.TypeSQLite},
|
||||||
ExpectedErr: sql.ErrPathNotSpecified,
|
ExpectedErr: sql.ErrPathNotSpecified,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "sqlite-with-file",
|
Name: "sqlite-with-path",
|
||||||
Cfg: &storage.Config{Type: storage.TypeSQLite, Path: t.TempDir() + "/TestInitialize_sqlite-with-file.db"},
|
Cfg: &storage.Config{Type: storage.TypeSQLite, Path: t.TempDir() + "/TestInitialize_sqlite-with-path.db"},
|
||||||
ExpectedErr: nil,
|
ExpectedErr: nil,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user