@@ -94,7 +94,7 @@ func TestAgentConnectionMonitor_ContextCancel(t *testing.T) {
9494 Return (nil )
9595 mDB .EXPECT ().UpdateWorkspaceAgentConnectionByID (
9696 gomock .Any (),
97- connectionUpdate (agentID , replicaID , withDisconnectedAfter (now )),
97+ connectionUpdate (agentID , replicaID , withDisconnectedNotBefore (now )),
9898 ).
9999 After (connected ).
100100 Times (1 ).
@@ -172,7 +172,7 @@ func TestAgentConnectionMonitor_PingTimeout(t *testing.T) {
172172 Return (nil )
173173 mDB .EXPECT ().UpdateWorkspaceAgentConnectionByID (
174174 gomock .Any (),
175- connectionUpdate (agent .ID , replicaID , withDisconnectedAfter (now )),
175+ connectionUpdate (agent .ID , replicaID , withDisconnectedNotBefore (now )),
176176 ).
177177 After (connected ).
178178 Times (1 ).
@@ -235,7 +235,7 @@ func TestAgentConnectionMonitor_BuildOutdated(t *testing.T) {
235235 Return (nil )
236236 mDB .EXPECT ().UpdateWorkspaceAgentConnectionByID (
237237 gomock .Any (),
238- connectionUpdate (agent .ID , replicaID , withDisconnectedAfter (now )),
238+ connectionUpdate (agent .ID , replicaID , withDisconnectedNotBefore (now )),
239239 ).
240240 After (connected ).
241241 Times (1 ).
@@ -320,7 +320,7 @@ func TestAgentConnectionMonitor_StartClose(t *testing.T) {
320320 Return (nil )
321321 mDB .EXPECT ().UpdateWorkspaceAgentConnectionByID (
322322 gomock .Any (),
323- connectionUpdate (agent .ID , replicaID , withDisconnectedAfter (now )),
323+ connectionUpdate (agent .ID , replicaID , withDisconnectedNotBefore (now )),
324324 ).
325325 After (connected ).
326326 Times (1 ).
@@ -423,10 +423,10 @@ func (f *fakeUpdater) getUpdates() int {
423423}
424424
425425type connectionUpdateMatcher struct {
426- agentID uuid.UUID
427- replicaID uuid.UUID
428- disconnectedAt sql.NullTime
429- disconnectedAfter sql.NullTime
426+ agentID uuid.UUID
427+ replicaID uuid.UUID
428+ disconnectedAt sql.NullTime
429+ disconnectedNotBefore sql.NullTime
430430}
431431
432432type connectionUpdateMatcherOption func (m connectionUpdateMatcher ) connectionUpdateMatcher
@@ -442,9 +442,9 @@ func connectionUpdate(id, replica uuid.UUID, opts ...connectionUpdateMatcherOpti
442442 return m
443443}
444444
445- func withDisconnectedAfter (t time.Time ) connectionUpdateMatcherOption {
445+ func withDisconnectedNotBefore (t time.Time ) connectionUpdateMatcherOption {
446446 return func (m connectionUpdateMatcher ) connectionUpdateMatcher {
447- m .disconnectedAfter = sql.NullTime {
447+ m .disconnectedNotBefore = sql.NullTime {
448448 Valid : true ,
449449 Time : t ,
450450 }
@@ -476,23 +476,23 @@ func (m connectionUpdateMatcher) Matches(x interface{}) bool {
476476 if args .LastConnectedReplicaID .UUID != m .replicaID {
477477 return false
478478 }
479- if m .disconnectedAfter .Valid {
479+ if m .disconnectedNotBefore .Valid {
480480 if ! args .DisconnectedAt .Valid {
481481 return false
482482 }
483- if ! args .DisconnectedAt .Time .After (m .disconnectedAfter .Time ) {
483+ if args .DisconnectedAt .Time .Before (m .disconnectedNotBefore .Time ) {
484484 return false
485485 }
486- // disconnectedAfter takes precedence over disconnectedAt
486+ // disconnectedNotBefore takes precedence over disconnectedAt
487487 } else if args .DisconnectedAt != m .disconnectedAt {
488488 return false
489489 }
490490 return true
491491}
492492
493493func (m connectionUpdateMatcher ) String () string {
494- return fmt .Sprintf ("{agent=%s, replica=%s, disconnectedAt=%v, disconnectedAfter =%v}" ,
495- m .agentID .String (), m .replicaID .String (), m .disconnectedAt , m .disconnectedAfter )
494+ return fmt .Sprintf ("{agent=%s, replica=%s, disconnectedAt=%v, disconnectedNotBefore =%v}" ,
495+ m .agentID .String (), m .replicaID .String (), m .disconnectedAt , m .disconnectedNotBefore )
496496}
497497
498498func (connectionUpdateMatcher ) Got (x interface {}) string {
0 commit comments