Merge branch 'master' into lash/purify-max

This commit is contained in:
lash
2025-01-10 11:40:49 +00:00
6 changed files with 168 additions and 44 deletions

View File

@@ -6,8 +6,6 @@ import (
"flag"
"log"
"math/rand"
"os"
"path/filepath"
"regexp"
"testing"
@@ -24,11 +22,9 @@ var (
)
var groupTestFile = flag.String("test-file", "group_test.json", "The test file to use for running the group tests")
func testStore() string {
v, _ := filepath.Abs(".test_state/state.gdbm")
return v
}
var database = flag.String("db", "gdbm", "Specify the database (gdbm or postgres)")
var connStr = flag.String("conn", ".test_state", "connection string")
var dbSchema = flag.String("schema", "test", "Specify the database schema (default test)")
func GenerateSessionId() string {
uu := uuid.NewGenWithOptions(uuid.WithRandomReader(g))
@@ -84,12 +80,15 @@ func extractSendAmount(response []byte) string {
}
func TestMain(m *testing.M) {
// Parse the flags
flag.Parse()
sessionID = GenerateSessionId()
defer func() {
if err := os.RemoveAll(testStore()); err != nil {
log.Fatalf("Failed to delete state store %s: %v", testStore(), err)
}
}()
// set the db
testutil.SetDatabase(*database, *connStr, *dbSchema)
// Cleanup the db after tests
defer testutil.CleanDatabase()
m.Run()
}
@@ -126,7 +125,6 @@ func TestAccountCreationSuccessful(t *testing.T) {
}
}
<-eventChannel
}
func TestAccountRegistrationRejectTerms(t *testing.T) {