Sha256: 873335ce916c4020b3b3e3daa32ba806ac0c0ea3e31af241e37bbae7314cb934

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'On-demand Azure Credentials' do
  require_libmongocrypt
  include_context 'define shared FLE helpers'
  include_context 'with Azure kms_providers'

  let(:client) { ClientRegistry.instance.new_local_client(SpecConfig.instance.addresses) }

  let(:client_encryption_opts) do
    {
      kms_providers: { azure: {} },
      kms_tls_options: kms_tls_options,
      key_vault_namespace: key_vault_namespace
    }
  end

  let(:client_encryption) do
    Mongo::ClientEncryption.new(
      client,
      client_encryption_opts
    )
  end

  context 'when credentials are available' do
    it 'authenticates successfully' do
      skip 'This tests should be run inside Azure Cloud only' unless ENV['TEST_FLE_AZURE_AUTO']

      expect do
        client_encryption.create_data_key('azure', data_key_options)
      end.not_to raise_error
    end
  end

  context 'when credentials are not available' do
    it 'raises an error' do
      skip 'This tests should NOT be run inside Azure Cloud only' if ENV['TEST_FLE_AZURE_AUTO']

      expect do
        client_encryption.create_data_key('azure', data_key_options)
      end.to raise_error(Mongo::Error::CryptError, /Azure credentials/)
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mongo-2.21.0 spec/integration/client_side_encryption/on_demand_azure_credentials_spec.rb
mongo-2.20.1 spec/integration/client_side_encryption/on_demand_azure_credentials_spec.rb
mogno-2.20.0 spec/integration/client_side_encryption/on_demand_azure_credentials_spec.rb
mogno-1.0.0 spec/integration/client_side_encryption/on_demand_azure_credentials_spec.rb
mongo-2.20.0 spec/integration/client_side_encryption/on_demand_azure_credentials_spec.rb
mongo-2.19.3 spec/integration/client_side_encryption/on_demand_azure_credentials_spec.rb
mongo-2.19.2 spec/integration/client_side_encryption/on_demand_azure_credentials_spec.rb
mongo-2.19.1 spec/integration/client_side_encryption/on_demand_azure_credentials_spec.rb
mongo-2.19.0 spec/integration/client_side_encryption/on_demand_azure_credentials_spec.rb