tests/robustness: allow persisting result reports for successful runs

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
This commit is contained in:
Madhav Jivrajani 2024-02-14 16:01:14 +05:30
parent cdd018ad2a
commit b51a834645
2 changed files with 3 additions and 1 deletions

View File

@ -31,6 +31,7 @@ Upon failure tests generate a report that can be used to attribute whether failu
It is recommended to run tests multiple times with failfast enabled. this can be done by setting `GO_TEST_FLAGS='--count=100 --failfast'`. It is recommended to run tests multiple times with failfast enabled. this can be done by setting `GO_TEST_FLAGS='--count=100 --failfast'`.
* `EXPECT_DEBUG=true` - to get logs from the cluster. * `EXPECT_DEBUG=true` - to get logs from the cluster.
* `RESULTS_DIR` - to change location where results report will be saved. * `RESULTS_DIR` - to change location where results report will be saved.
* `PERSIST_RESULTS` - to persist the results report of the test. By default this will not be persisted in the case of a successful run.
## Analysing failure ## Analysing failure

View File

@ -59,7 +59,8 @@ func testResultsDirectory(t *testing.T) string {
func (r *TestReport) Report(t *testing.T, force bool) { func (r *TestReport) Report(t *testing.T, force bool) {
path := testResultsDirectory(t) path := testResultsDirectory(t)
if t.Failed() || force { _, ok := os.LookupEnv("PERSIST_RESULTS")
if t.Failed() || force || ok {
for _, member := range r.Cluster.Procs { for _, member := range r.Cluster.Procs {
memberDataDir := filepath.Join(path, fmt.Sprintf("server-%s", member.Config().Name)) memberDataDir := filepath.Join(path, fmt.Sprintf("server-%s", member.Config().Name))
persistMemberDataDir(t, r.Logger, member, memberDataDir) persistMemberDataDir(t, r.Logger, member, memberDataDir)