read test file from test run arg

This commit is contained in:
Carlosokumu 2024-12-05 14:05:32 +03:00
parent 22f96363ba
commit 160ccbb220
Signed by untrusted user: carlos
GPG Key ID: 7BD6BC8160A5C953

View File

@ -3,6 +3,7 @@ package menutraversaltest
import (
"bytes"
"context"
"flag"
"log"
"math/rand"
"os"
@ -15,14 +16,15 @@ import (
)
var (
testData = driver.ReadData()
testStore = ".test_state"
groupTestFile = "group_test.json"
sessionID string
src = rand.NewSource(42)
g = rand.New(src)
testData = driver.ReadData()
testStore = ".test_state"
sessionID string
src = rand.NewSource(42)
g = rand.New(src)
)
var groupTestFile = flag.String("test-file", "group_test.json", "The test file to use for running the group tests")
func GenerateSessionId() string {
uu := uuid.NewGenWithOptions(uuid.WithRandomReader(g))
v, err := uu.NewV4()
@ -337,7 +339,7 @@ func TestMainMenuSend(t *testing.T) {
}
func TestGroups(t *testing.T) {
groups, err := driver.LoadTestGroups(groupTestFile)
groups, err := driver.LoadTestGroups(*groupTestFile)
if err != nil {
log.Fatalf("Failed to load test groups: %v", err)
}