Skip to content

Commit

Permalink
Remove nolint
Browse files Browse the repository at this point in the history
  • Loading branch information
prestonvasquez committed Sep 20, 2024
1 parent be52a4f commit 18b4731
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions internal/integration/unified/event_verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ func verifyCommandEvents(ctx context.Context, client *clientEntity, expectedEven
return nil
}

//nolint:govet
func verifyCMAPEvents(client *clientEntity, expectedEvents *expectedEvents) error {
pooled := client.poolEvents()
if len(expectedEvents.CMAPEvents) == 0 && len(pooled) != 0 {
Expand All @@ -315,16 +314,16 @@ func verifyCMAPEvents(client *clientEntity, expectedEvents *expectedEvents) erro
switch {
case evt.ConnectionCreatedEvent != nil:
if _, pooled, err = getNextPoolEvent(pooled, event.ConnectionCreated); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error())
}
case evt.ConnectionReadyEvent != nil:
if _, pooled, err = getNextPoolEvent(pooled, event.ConnectionReady); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error())
}
case evt.ConnectionClosedEvent != nil:
var actual *event.PoolEvent
if actual, pooled, err = getNextPoolEvent(pooled, event.ConnectionClosed); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error())
}

if expectedReason := evt.ConnectionClosedEvent.Reason; expectedReason != nil {
Expand All @@ -334,12 +333,12 @@ func verifyCMAPEvents(client *clientEntity, expectedEvents *expectedEvents) erro
}
case evt.ConnectionCheckedOutEvent != nil:
if _, pooled, err = getNextPoolEvent(pooled, event.ConnectionCheckedOut); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error())
}
case evt.ConnectionCheckOutFailedEvent != nil:
var actual *event.PoolEvent
if actual, pooled, err = getNextPoolEvent(pooled, event.ConnectionCheckOutFailed); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error())
}

if expectedReason := evt.ConnectionCheckOutFailedEvent.Reason; expectedReason != nil {
Expand All @@ -349,12 +348,12 @@ func verifyCMAPEvents(client *clientEntity, expectedEvents *expectedEvents) erro
}
case evt.ConnectionCheckedInEvent != nil:
if _, pooled, err = getNextPoolEvent(pooled, event.ConnectionCheckedIn); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error())
}
case evt.PoolClearedEvent != nil:
var actual *event.PoolEvent
if actual, pooled, err = getNextPoolEvent(pooled, event.ConnectionPoolCleared); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next pool event: %v", err.Error())
}
if expectServiceID := evt.PoolClearedEvent.HasServiceID; expectServiceID != nil {
if err := verifyServiceID(*expectServiceID, actual.ServiceID); err != nil {
Expand Down Expand Up @@ -492,7 +491,6 @@ func getNextTopologyDescriptionChangedEvent(
return events[0], events[:1], nil
}

//nolint:govet
func verifySDAMEvents(client *clientEntity, expectedEvents *expectedEvents) error {
var (
changed = client.serverDescriptionChanged
Expand All @@ -515,7 +513,7 @@ func verifySDAMEvents(client *clientEntity, expectedEvents *expectedEvents) erro
case evt.ServerDescriptionChangedEvent != nil:
var got *event.ServerDescriptionChangedEvent
if got, changed, err = getNextServerDescriptionChangedEvent(changed); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next server description changed event: %v", err.Error())
}

prevDesc := evt.ServerDescriptionChangedEvent.NewDescription
Expand Down Expand Up @@ -546,7 +544,7 @@ func verifySDAMEvents(client *clientEntity, expectedEvents *expectedEvents) erro
case evt.ServerHeartbeatStartedEvent != nil:
var got *event.ServerHeartbeatStartedEvent
if got, started, err = getNextServerHeartbeatStartedEvent(started); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next server heartbeat event: %v", err.Error())
}

if want := evt.ServerHeartbeatStartedEvent.Awaited; want != nil && *want != got.Awaited {
Expand All @@ -555,7 +553,7 @@ func verifySDAMEvents(client *clientEntity, expectedEvents *expectedEvents) erro
case evt.ServerHeartbeatSucceededEvent != nil:
var got *event.ServerHeartbeatSucceededEvent
if got, succeeded, err = getNextServerHeartbeatSucceededEvent(succeeded); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next server heartbeat event: %v", err.Error())
}

if want := evt.ServerHeartbeatSucceededEvent.Awaited; want != nil && *want != got.Awaited {
Expand All @@ -564,15 +562,15 @@ func verifySDAMEvents(client *clientEntity, expectedEvents *expectedEvents) erro
case evt.ServerHeartbeatFailedEvent != nil:
var got *event.ServerHeartbeatFailedEvent
if got, failed, err = getNextServerHeartbeatFailedEvent(failed); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next server heartbeat event: %v", err.Error())
}

if want := evt.ServerHeartbeatFailedEvent.Awaited; want != nil && *want != got.Awaited {
return newEventVerificationError(idx, client, "want awaited %v, got %v", *want, got.Awaited)
}
case evt.TopologyDescriptionChangedEvent != nil:
if _, tchanged, err = getNextTopologyDescriptionChangedEvent(tchanged); err != nil {
return newEventVerificationError(idx, client, err.Error())
return newEventVerificationError(idx, client, "failed to get next description changed event: %v", err.Error())
}
}
}
Expand Down

0 comments on commit 18b4731

Please sign in to comment.