MCPcopy Create free account
hub / github.com/coder/coder / Test_nodesEqual

Function Test_nodesEqual

enterprise/tailnet/pgcoord_internal_test.go:523–559  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

521}
522
523func Test_nodesEqual(t *testing.T) {
524 t.Parallel()
525
526 t.Run("BothNil", func(t *testing.T) {
527 t.Parallel()
528 assert.True(t, nodesEqual(nil, nil))
529 })
530
531 t.Run("OneNil", func(t *testing.T) {
532 t.Parallel()
533 assert.False(t, nodesEqual(&proto.Node{PreferredDerp: 1}, nil))
534 assert.False(t, nodesEqual(nil, &proto.Node{PreferredDerp: 1}))
535 })
536
537 t.Run("IgnoresAsOf", func(t *testing.T) {
538 t.Parallel()
539 a := &proto.Node{
540 PreferredDerp: 1,
541 AsOf: timestamppb.Now(),
542 }
543 b := &proto.Node{
544 PreferredDerp: 1,
545 AsOf: timestamppb.New(time.Now().Add(-time.Hour)),
546 }
547 assert.True(t, nodesEqual(a, b))
548 // Verify AsOf fields are restored.
549 assert.NotNil(t, a.AsOf)
550 assert.NotNil(t, b.AsOf)
551 })
552
553 t.Run("DifferentPreferredDERP", func(t *testing.T) {
554 t.Parallel()
555 a := &proto.Node{PreferredDerp: 1}
556 b := &proto.Node{PreferredDerp: 2}
557 assert.False(t, nodesEqual(a, b))
558 })
559}
560
561func Test_storeBinding(t *testing.T) {
562 t.Parallel()

Callers

nothing calls this directly

Calls 4

nodesEqualFunction · 0.85
RunMethod · 0.65
NewMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected