Merge pull request #18133 from serathius/robustness-connection-reset

Ignore connection reset error when triggering a failpoint
This commit is contained in:
Marek Siarkowicz 2024-06-07 10:23:14 +02:00 committed by GitHub
commit 2ffaf5fba4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,7 +41,7 @@ func (t triggerDefrag) Trigger(ctx context.Context, _ *testing.T, member e2e.Etc
}
defer cc.Close()
_, err = cc.Defragment(ctx)
if err != nil && !strings.Contains(err.Error(), "error reading from server: EOF") {
if err != nil && !connectionError(err) {
return nil, err
}
return nil, nil
@ -77,7 +77,7 @@ func (t triggerCompact) Trigger(ctx context.Context, _ *testing.T, member e2e.Et
time.Sleep(50 * time.Millisecond)
}
_, err = cc.Compact(ctx, rev)
if err != nil && !strings.Contains(err.Error(), "error reading from server: EOF") {
if err != nil && !connectionError(err) {
return nil, err
}
return []report.ClientReport{cc.Report()}, nil
@ -86,3 +86,7 @@ func (t triggerCompact) Trigger(ctx context.Context, _ *testing.T, member e2e.Et
func (t triggerCompact) Available(e2e.EtcdProcessClusterConfig, e2e.EtcdProcess) bool {
return true
}
func connectionError(err error) bool {
return strings.Contains(err.Error(), "error reading from server: EOF") || strings.HasSuffix(err.Error(), "read: connection reset by peer")
}