Sha256: 6b3a5a8bb61a73a75748da79debb221d3adc9b5f8f9c8c9b49317aecaa3534f9

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true
# rubocop:todo all

require 'spec_helper'

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

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

  let(:client_encryption_opts) do
    {
      kms_providers: { gcp: {} },
      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 Google Cloud only' unless ENV['TEST_FLE_GCP_AUTO']
      expect do
        client_encryption.create_data_key('gcp', 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 Google Cloud only' if ENV['TEST_FLE_GCP_AUTO']

      expect do
        client_encryption.create_data_key('gcp', data_key_options)
      end.to raise_error(Mongo::Error::CryptError, /GCP 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_gcp_credentials_spec.rb
mongo-2.20.1 spec/integration/client_side_encryption/on_demand_gcp_credentials_spec.rb
mogno-2.20.0 spec/integration/client_side_encryption/on_demand_gcp_credentials_spec.rb
mogno-1.0.0 spec/integration/client_side_encryption/on_demand_gcp_credentials_spec.rb
mongo-2.20.0 spec/integration/client_side_encryption/on_demand_gcp_credentials_spec.rb
mongo-2.19.3 spec/integration/client_side_encryption/on_demand_gcp_credentials_spec.rb
mongo-2.19.2 spec/integration/client_side_encryption/on_demand_gcp_credentials_spec.rb
mongo-2.19.1 spec/integration/client_side_encryption/on_demand_gcp_credentials_spec.rb
mongo-2.19.0 spec/integration/client_side_encryption/on_demand_gcp_credentials_spec.rb