-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
96 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Program mkdb is supposed to be executed with `go run` from the root of the repository. | ||
// It will create a (more or less) deterministic snapshot of the current schema of our database, | ||
// which we can then use in tests to verify our migration scripts actually end up where we want them to. | ||
package main | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"fmt" | ||
"mintter/backend/config" | ||
"mintter/backend/core/coretest" | ||
"mintter/backend/daemon" | ||
"os" | ||
|
||
"github.com/burdiyan/go/mainutil" | ||
) | ||
|
||
func main() { | ||
mainutil.Run(run) | ||
} | ||
|
||
func run() error { | ||
ctx, cancel := context.WithCancel(mainutil.TrapSignals()) | ||
defer cancel() | ||
|
||
alice := coretest.NewTester("alice") | ||
|
||
cfg := config.Default() | ||
cfg.P2P.NoRelay = true | ||
cfg.P2P.BootstrapPeers = nil | ||
cfg.RepoPath = "/tmp/mintter-test-db-snapshot" | ||
|
||
if err := os.RemoveAll(cfg.RepoPath); err != nil { | ||
return err | ||
} | ||
|
||
if err := os.MkdirAll(cfg.RepoPath, 0750); err != nil { | ||
return err | ||
} | ||
|
||
dir, err := daemon.InitRepo(cfg, alice.Device.Wrapped()) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
app, err := daemon.LoadWithStorage(ctx, cfg, dir) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if err := app.RPC.Daemon.RegisterAccount(ctx, alice.Account); err != nil { | ||
return err | ||
} | ||
|
||
cancel() | ||
|
||
err = app.Wait() | ||
fmt.Println("Database has been saved in:", cfg.RepoPath) | ||
if errors.Is(err, context.Canceled) { | ||
return nil | ||
} | ||
|
||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
backend/daemon/storage/testdata/initial-data-dir/keys/libp2p_id_ed25519
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
backend/daemon/storage/testdata/initial-data-dir/keys/mintter_id_ed25519.pub
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
backend/daemon/storage/testdata/initial-data-dir/mintterd.conf
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
backend/daemon/storage/testdata/mintter-test-db-snapshot/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2023-08-30.01 |
Binary file renamed
BIN
+4 KB
...ge/testdata/initial-data-dir/db/db.sqlite → ...ata/mintter-test-db-snapshot/db/db.sqlite
Binary file not shown.
Binary file renamed
BIN
+32 KB
...estdata/initial-data-dir/db/db.sqlite-shm → ...mintter-test-db-snapshot/db/db.sqlite-shm
Binary file not shown.
Binary file renamed
BIN
+189 KB
...estdata/initial-data-dir/db/db.sqlite-wal → ...mintter-test-db-snapshot/db/db.sqlite-wal
Binary file not shown.
1 change: 1 addition & 0 deletions
1
backend/daemon/storage/testdata/mintter-test-db-snapshot/keys/libp2p_id_ed25519
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@�����Z�(\u�-w@^�����8HHchT�1RA>�;^�àB��g8��&�����i���+ڑE2� |
1 change: 1 addition & 0 deletions
1
backend/daemon/storage/testdata/mintter-test-db-snapshot/keys/mintter_id_ed25519.pub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
��Z����&�R6﹛�3A��0��"�` | ||
|