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 <siarkowicz@google.com>
  • Loading branch information
serathius committed Oct 23, 2024
1 parent 4a442c4 commit c95e8fa
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 @@ -60,11 +60,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 @@ -80,36 +76,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 c95e8fa

Please sign in to comment.