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 ( import (
"bytes" "bytes"
"context" "context"
"flag"
"log" "log"
"math/rand" "math/rand"
"os" "os"
@ -15,14 +16,15 @@ import (
) )
var ( var (
testData = driver.ReadData() testData = driver.ReadData()
testStore = ".test_state" testStore = ".test_state"
groupTestFile = "group_test.json" sessionID string
sessionID string src = rand.NewSource(42)
src = rand.NewSource(42) g = rand.New(src)
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 { func GenerateSessionId() string {
uu := uuid.NewGenWithOptions(uuid.WithRandomReader(g)) uu := uuid.NewGenWithOptions(uuid.WithRandomReader(g))
v, err := uu.NewV4() v, err := uu.NewV4()
@ -337,7 +339,7 @@ func TestMainMenuSend(t *testing.T) {
} }
func TestGroups(t *testing.T) { func TestGroups(t *testing.T) {
groups, err := driver.LoadTestGroups(groupTestFile) groups, err := driver.LoadTestGroups(*groupTestFile)
if err != nil { if err != nil {
log.Fatalf("Failed to load test groups: %v", err) log.Fatalf("Failed to load test groups: %v", err)
} }