mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
feat(cli): default --clear-data on so runs start fresh
This commit is contained in:
1 parent
a10791e00f
commit
0abbcd7d0c
2 files changed
+7
-7
No files matched your search
@@ -52,7 +52,7 @@ func parseTestArgs(args []string, stderr io.Writer) (testOptions, error) {
|
|||||||
flagSet.DurationVar(&options.duration, "duration", 5*time.Minute, "total test duration")
|
flagSet.DurationVar(&options.duration, "duration", 5*time.Minute, "total test duration")
|
||||||
flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)")
|
flagSet.Int64Var(&options.seed, "seed", 0, "RNG seed (0 = random)")
|
||||||
flagSet.StringVar(&options.output, "output", "./runs", "output directory for traces")
|
flagSet.StringVar(&options.output, "output", "./runs", "output directory for traces")
|
||||||
flagSet.BoolVar(&options.clearData, "clear-data", false, "clear app data before launching so the run starts from a fresh install")
|
flagSet.BoolVar(&options.clearData, "clear-data", true, "clear app data before launching so each run starts from a fresh install; pass --clear-data=false to resume prior state")
|
||||||
if err := flagSet.Parse(args); err != nil {
|
if err := flagSet.Parse(args); err != nil {
|
||||||
return testOptions{}, err
|
return testOptions{}, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,22 +32,22 @@ func TestParseTestArgs_Defaults(t *testing.T) {
|
|||||||
if options.seed != 0 {
|
if options.seed != 0 {
|
||||||
t.Errorf("seed default: got %d, want 0", options.seed)
|
t.Errorf("seed default: got %d, want 0", options.seed)
|
||||||
}
|
}
|
||||||
if options.clearData {
|
if !options.clearData {
|
||||||
t.Errorf("clearData default: got true, want false")
|
t.Errorf("clearData default: got false, want true")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestParseTestArgs_ClearDataFlag(t *testing.T) {
|
func TestParseTestArgs_ClearDataDisabled(t *testing.T) {
|
||||||
options, err := parseTestArgs([]string{
|
options, err := parseTestArgs([]string{
|
||||||
"--spec", "s.ts",
|
"--spec", "s.ts",
|
||||||
"--bundle-id", "com.example",
|
"--bundle-id", "com.example",
|
||||||
"--clear-data",
|
"--clear-data=false",
|
||||||
}, io.Discard)
|
}, io.Discard)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
if !options.clearData {
|
if options.clearData {
|
||||||
t.Errorf("expected clearData=true, got false")
|
t.Errorf("expected clearData=false, got true")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user