From 054354b3848e1096cedfb3955cb5fb7628ca682a Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Fri, 27 Dec 2024 11:51:53 +0100 Subject: [PATCH] Slightly improve sqlite db engine tests --- go/daemon/network/network_it_test.go | 5 ++++- tasks/nats/add.md | 13 +++++++++++++ tasks/nats/garage-watcher.md | 28 ++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tasks/nats/add.md create mode 100644 tasks/nats/garage-watcher.md diff --git a/go/daemon/network/network_it_test.go b/go/daemon/network/network_it_test.go index f3ffbb8..4a5a3d1 100644 --- a/go/daemon/network/network_it_test.go +++ b/go/daemon/network/network_it_test.go @@ -145,13 +145,14 @@ func TestNetwork_SetConfig(t *testing.T) { h = newIntegrationHarness(t) network = h.createNetwork(t, "primus", nil) networkConfig = network.getConfig(t) + metaPath = h.mkDir(t, "meta").Path ) networkConfig.Storage.Allocations = append( networkConfig.Storage.Allocations, daecommon.ConfigStorageAllocation{ DataPath: h.mkDir(t, "data").Path, - MetaPath: h.mkDir(t, "meta").Path, + MetaPath: metaPath, Capacity: 1, S3APIPort: 4900, RPCPort: 4901, @@ -199,6 +200,7 @@ func TestNetwork_SetConfig(t *testing.T) { string(garageConfig), `db_engine = "`+garagesrv.DBEngineSqlite+`"`, ) + assert.FileExists(t, filepath.Join(metaPath, "db.sqlite")) }) t.Run("add storage alloc/lmdb", func(t *testing.T) { @@ -238,6 +240,7 @@ func TestNetwork_SetConfig(t *testing.T) { string(garageConfig), `db_engine = "`+garagesrv.DBEngineLMDB+`"`, ) + assert.NoFileExists(t, filepath.Join(metaPath, "db.sqlite")) }) t.Run("remove storage alloc", func(t *testing.T) { diff --git a/tasks/nats/add.md b/tasks/nats/add.md new file mode 100644 index 0000000..6ecb44a --- /dev/null +++ b/tasks/nats/add.md @@ -0,0 +1,13 @@ +--- +type: tasks +--- + +Introduce [NATS][nats] as a new service run by Isle. All hosts should join the +NATS network. + +* The nebula lighthouse hosts can be used as the bootstrap nodes for finding the + rest of the NATS peers. + +* The firewall must have a port automatically opened on it for all hosts. + +[nats]: https://nats.io/ diff --git a/tasks/nats/garage-watcher.md b/tasks/nats/garage-watcher.md new file mode 100644 index 0000000..a928f3a --- /dev/null +++ b/tasks/nats/garage-watcher.md @@ -0,0 +1,28 @@ +--- +type: tasks +after: + - ./add.md +--- + +A simple mechanism should be developed which "watches" a garage directory or +file for changes. This mechanism has too sides. + +## Producer + +When making a change to a file in garage (putting or deleting) the producer +should publish the path to that file to a bucket-specific pubsub channel on +NATS. + +This only applies for file changes which are expected to have a watcher. + +## Watcher + +The watcher is a simple mechanism which looks like this: + +```go +type Watcher interface { + Wait(context.Context) (string, error) // returns the path to the changed file +} +``` + +It can be initialized with either a specific file path or a doublestar matcher.