Sha256: a7c6192efa4c883f398e149c3aaa1e2384ce1e382b5afaec8df2af6d73150fdd

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe 'Server description' do
  describe '#op_time' do
    require_topology :replica_set
    min_server_version '3.4'

    let(:client) { ClientRegistry.instance.global_client('authorized') }
    let(:desc) { client.cluster.servers.first.description }

    it 'is set' do
      client.database.command(ismaster: 1)

      expect(desc.op_time).to be_a(BSON::Timestamp)
    end
  end

  describe '#last_write_date' do
    require_topology :replica_set
    min_server_version '3.4'

    let(:client) { ClientRegistry.instance.global_client('authorized') }
    let(:desc) { client.cluster.servers.first.description }

    it 'is set' do
      client.database.command(ismaster: 1)

      expect(desc.last_write_date).to be_a(Time)
    end
  end

  describe '#last_update_time' do
    before do
      ClientRegistry.instance.close_all_clients
    end

    let(:client) { ClientRegistry.instance.global_client('authorized') }
    let(:desc) { client.cluster.servers.first.description }

    it 'is set' do
      client.database.command(ismaster: 1)

      expect(desc.last_update_time).to be_a(Time)
      # checked in the last 3 seconds
      expect(Time.now - desc.last_update_time < 3).to be true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongo-2.7.0 spec/integration/server_description_spec.rb
mongo-2.7.0.rc0 spec/integration/server_description_spec.rb