Skip to content

Commit

Permalink
Limit a timeout in testing and add a scenario to confirm history patc…
Browse files Browse the repository at this point in the history
…hing is providing a speedup

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
  • Loading branch information
serathius committed Mar 25, 2024
1 parent e4448c4 commit 0f0e90f
Show file tree
Hide file tree
Showing 18 changed files with 1,769 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/robustness/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func testRobustness(ctx context.Context, t *testing.T, lg *zap.Logger, s testSce
watchProgressNotifyEnabled := report.Cluster.Cfg.ServerConfig.ExperimentalWatchProgressNotifyInterval != 0
validateGotAtLeastOneProgressNotify(t, report.Client, s.watch.requestProgress || watchProgressNotifyEnabled)
validateConfig := validate.Config{ExpectRevisionUnique: s.traffic.ExpectUniqueRevision()}
report.Visualize = validate.ValidateAndReturnVisualize(t, lg, validateConfig, report.Client)
report.Visualize = validate.ValidateAndReturnVisualize(t, lg, validateConfig, report.Client, 5*time.Minute)

panicked = false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ClientId":0,"Input":{"Type":"txn","LeaseGrant":null,"LeaseRevoke":null,"Range":null,"Txn":{"Conditions":null,"OperationsOnSuccess":[{"Type":"put-operation","Range":{"Start":"","End":"","Limit":0},"Put":{"Key":"tombstone","Value":{"Value":"true","Hash":0},"LeaseID":0},"Delete":{"Key":""}}],"OperationsOnFailure":null},"Defragment":null},"Call":3348780031,"Output":{"Txn":{"Failure":false,"Results":[{"KVs":null,"Count":0,"Deleted":0}]},"Range":null,"LeaseGrant":null,"LeaseRevoke":null,"Defragment":null,"Revision":862,"PartialResponse":false,"Error":""},"Return":3350925284}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions tests/robustness/validate/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ import (
"go.etcd.io/etcd/tests/v3/robustness/model"
)

func validateLinearizableOperationsAndVisualize(lg *zap.Logger, operations []porcupine.Operation) (result porcupine.CheckResult, visualize func(basepath string) error) {
const timeout = 5 * time.Minute
func validateLinearizableOperationsAndVisualize(lg *zap.Logger, operations []porcupine.Operation, timeout time.Duration) (result porcupine.CheckResult, visualize func(basepath string) error) {
lg.Info("Validating linearizable operations", zap.Duration("timeout", timeout))
start := time.Now()
result, info := porcupine.CheckOperationsVerbose(model.NonDeterministicModel, operations, timeout)
switch result {
case porcupine.Illegal:
lg.Error("Linearization failed")
lg.Error("Linearization failed", zap.Duration("duration", time.Since(start)))
case porcupine.Unknown:
lg.Error("Linearization has timed out")
lg.Error("Linearization has timed out", zap.Duration("duration", time.Since(start)))
case porcupine.Ok:
lg.Info("Linearization success")
lg.Info("Linearization success", zap.Duration("duration", time.Since(start)))
default:
panic(fmt.Sprintf("Unknown Linearization result %s", result))
}
Expand Down
5 changes: 3 additions & 2 deletions tests/robustness/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"fmt"
"sort"
"testing"
"time"

"github.com/anishathalye/porcupine"
"github.com/google/go-cmp/cmp"
Expand All @@ -28,9 +29,9 @@ import (
)

// ValidateAndReturnVisualize returns visualize as porcupine.linearizationInfo used to generate visualization is private.
func ValidateAndReturnVisualize(t *testing.T, lg *zap.Logger, cfg Config, reports []report.ClientReport) (visualize func(basepath string) error) {
func ValidateAndReturnVisualize(t *testing.T, lg *zap.Logger, cfg Config, reports []report.ClientReport, timeout time.Duration) (visualize func(basepath string) error) {
patchedOperations := patchedOperationHistory(reports)
linearizable, visualize := validateLinearizableOperationsAndVisualize(lg, patchedOperations)
linearizable, visualize := validateLinearizableOperationsAndVisualize(lg, patchedOperations, timeout)
if linearizable != porcupine.Ok {
t.Error("Failed linearization, skipping further validation")
return visualize
Expand Down
3 changes: 2 additions & 1 deletion tests/robustness/validate/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"os"
"path/filepath"
"testing"
"time"

"github.com/stretchr/testify/assert"
"go.uber.org/zap/zaptest"
Expand All @@ -37,7 +38,7 @@ func TestValidate(t *testing.T) {
path := filepath.Join(testdataPath, file.Name())
reports, err := report.LoadClientReports(path)
assert.NoError(t, err)
visualize := ValidateAndReturnVisualize(t, zaptest.NewLogger(t), Config{}, reports)
visualize := ValidateAndReturnVisualize(t, zaptest.NewLogger(t), Config{}, reports, 15*time.Second)

if t.Failed() {
err := visualize(filepath.Join(path, "history.html"))
Expand Down

0 comments on commit 0f0e90f

Please sign in to comment.