Skip to content

Commit

Permalink
Allow duplicated put requests
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Siarkowicz <[email protected]>
  • Loading branch information
serathius committed Nov 16, 2024
1 parent 77ccb8d commit 4e4c74f
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions tests/robustness/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ type Config struct {
}

func checkValidationAssumptions(reports []report.ClientReport, persistedRequests []model.EtcdRequest) error {
err := validatePutOperationUnique(reports)
if err != nil {
return err
}
err = validateEmptyDatabaseAtStart(reports)
err := validateEmptyDatabaseAtStart(reports)
if err != nil {
return err
}
Expand All @@ -79,36 +75,6 @@ func checkValidationAssumptions(reports []report.ClientReport, persistedRequests
return nil
}

func validatePutOperationUnique(reports []report.ClientReport) error {
type KV struct {
Key string
Value model.ValueOrHash
}
putValue := map[KV]struct{}{}
for _, r := range reports {
for _, op := range r.KeyValue {
request := op.Input.(model.EtcdRequest)
if request.Type != model.Txn {
continue
}
for _, op := range append(request.Txn.OperationsOnSuccess, request.Txn.OperationsOnFailure...) {
if op.Type != model.PutOperation {
continue
}
kv := KV{
Key: op.Put.Key,
Value: op.Put.Value,
}
if _, ok := putValue[kv]; ok {
return fmt.Errorf("non unique put %v, required to patch operation history", kv)
}
putValue[kv] = struct{}{}
}
}
}
return nil
}

func validateEmptyDatabaseAtStart(reports []report.ClientReport) error {
for _, r := range reports {
for _, op := range r.KeyValue {
Expand Down

0 comments on commit 4e4c74f

Please sign in to comment.