Minor updates
This commit is contained in:
		
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								README.md
									
									
									
									
									
								
							| @ -235,12 +235,17 @@ Here are some examples of conditions you can use: | ||||
| | Parameter          | Description                                                                            | Default        | | ||||
| |:------------------ |:-------------------------------------------------------------------------------------- |:-------------- | | ||||
| | `storage`          | Storage configuration                                                                  | `{}`           | | ||||
| | `storage.file`     | Path to persist the data in. If the type is `memory`, data is persisted on interval.   | `""`           | | ||||
| | `storage.type`     | Type of storage. Valid types: `memory`, `sqlite`, `postgres` (ALPHA).                  | `"memory"`     | | ||||
| | `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`.                          | `"memory"`     | | ||||
|  | ||||
| - If `storage.type` is `memory` (default) and `storage.file` is set to a non-blank value. | ||||
|   Furthermore, the data is periodically persisted, but everything remains in memory. | ||||
| - If `storage.type` is `sqlite`, `storage.file` must not be blank: | ||||
| - If `storage.type` is `memory` (default): | ||||
| ```yaml | ||||
| # 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 | ||||
| storage: | ||||
|   type: sqlite | ||||
| @ -248,7 +253,7 @@ storage: | ||||
| ``` | ||||
| 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 | ||||
| storage: | ||||
|   type: postgres | ||||
|  | ||||
| @ -169,8 +169,8 @@ func TestStore_InsertCleansUpEventsAndResultsProperly(t *testing.T) { | ||||
| } | ||||
|  | ||||
| func TestStore_Persistence(t *testing.T) { | ||||
| 	file := t.TempDir() + "/TestStore_Persistence.db" | ||||
| 	store, _ := NewStore("sqlite", file) | ||||
| 	path := t.TempDir() + "/TestStore_Persistence.db" | ||||
| 	store, _ := NewStore("sqlite", path) | ||||
| 	store.Insert(&testEndpoint, &testSuccessfulResult) | ||||
| 	store.Insert(&testEndpoint, &testUnsuccessfulResult) | ||||
| 	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") | ||||
| 	} | ||||
| 	store.Close() | ||||
| 	store, _ = NewStore("sqlite", file) | ||||
| 	store, _ = NewStore("sqlite", path) | ||||
| 	defer store.Close() | ||||
| 	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 { | ||||
|  | ||||
| @ -547,23 +547,23 @@ func TestInitialize(t *testing.T) { | ||||
| 			ExpectedErr: nil, | ||||
| 		}, | ||||
| 		{ | ||||
| 			Name:        "memory-no-file", | ||||
| 			Name:        "memory-no-path", | ||||
| 			Cfg:         &storage.Config{Type: storage.TypeMemory}, | ||||
| 			ExpectedErr: nil, | ||||
| 		}, | ||||
| 		{ | ||||
| 			Name:        "memory-with-file", | ||||
| 			Cfg:         &storage.Config{Type: storage.TypeMemory, Path: t.TempDir() + "/TestInitialize_memory-with-file.db"}, | ||||
| 		{ // XXX: Remove for v4.0.0. See https://github.com/TwiN/gatus/issues/198 | ||||
| 			Name:        "memory-with-path", | ||||
| 			Cfg:         &storage.Config{Type: storage.TypeMemory, Path: t.TempDir() + "/TestInitialize_memory-with-path.db"}, | ||||
| 			ExpectedErr: nil, | ||||
| 		}, | ||||
| 		{ | ||||
| 			Name:        "sqlite-no-file", | ||||
| 			Name:        "sqlite-no-path", | ||||
| 			Cfg:         &storage.Config{Type: storage.TypeSQLite}, | ||||
| 			ExpectedErr: sql.ErrPathNotSpecified, | ||||
| 		}, | ||||
| 		{ | ||||
| 			Name:        "sqlite-with-file", | ||||
| 			Cfg:         &storage.Config{Type: storage.TypeSQLite, Path: t.TempDir() + "/TestInitialize_sqlite-with-file.db"}, | ||||
| 			Name:        "sqlite-with-path", | ||||
| 			Cfg:         &storage.Config{Type: storage.TypeSQLite, Path: t.TempDir() + "/TestInitialize_sqlite-with-path.db"}, | ||||
| 			ExpectedErr: nil, | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
		Reference in New Issue
	
	Block a user