<commit_before># coding: utf-8

require 'rubygems'
require 'httparty'
require 'json'
require 'rspec'
require 'rspec/expectations'


$address = ENV['ARANGO_SERVER'] || '127.0.0.1:8529'
$user = ENV['ARANGO_USER']
$password = ENV['<PASSWORD>']
$ssl = ENV['ARANGO_SSL']
$silent = ENV['ARANGO_NO_LOG'] || ''

begin
  $address = RSpec.configuration.ARANGO_SERVER
rescue
end
begin
  $user = RSpec.configuration.ARANGO_USER
rescue
end
begin
  $password = RSpec.configuration.ARANGO_PASSWORD
rescue
end
begin
  $ssl = RSpec.configuration.ARANGO_SSL
rescue
end

RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = [ :should, :expect ]
  end
  config.mock_with :rspec do |c|
    c.syntax = [ :should, :expect ]
  end
  # tests to be excluded when under ssl
  if $ssl == '1'
    config.filter_run_excluding :ssl => true
  end
end

################################################################################
## cross rspec version compatibility tool: 
################################################################################
RSpec::Matchers.define :be_nil_or_empty do
 match do |actual|
   actual.nil? || actual.empty?
 end
end

class ArangoDB
  include HTTParty

  if $ssl == '1'
    base_uri "https://#{$address}"
  else
    base_uri "http://#{$address}"
  end 

  # set HTTP basic authorization
  basic_auth $user, $password

  # expect json as output/response format
  format :json

  # set timeout to 120 seconds
  default_timeout 120 

  # do not verify SSL
  default_options[:verify] = false

################################################################################
## adjust the global client-side timeout value
################################################################################

  def self.set_timeout (value) 
    old_value = default_options[:timeout] 
    default_options[:timeout] = value
    old_value
  end

  def self.set_read_timeout (value) 
    old_value = default_options[:read_timeout] 
    default_options[:read_timeout] = value
    old_value
  end
  
################################################################################
## create a collection
################################################################################
<commit_msg>Increase timeout, so we can see cluster internal timeouts and their error messages.<commit_after># coding: utf-8

require 'rubygems'
require 'httparty'
require 'json'
require 'rspec'
require 'rspec/expectations'


$address = ENV['ARANGO_SERVER'] || '127.0.0.1:8529'
$user = ENV['ARANGO_USER']
$password = ENV['<PASSWORD>']
$ssl = ENV['ARANGO_SSL']
$silent = ENV['ARANGO_NO_LOG'] || ''

begin
  $address = RSpec.configuration.ARANGO_SERVER
rescue
end
begin
  $user = RSpec.configuration.ARANGO_USER
rescue
end
begin
  $password = RSpec.configuration.ARANGO_PASSWORD
rescue
end
begin
  $ssl = RSpec.configuration.ARANGO_SSL
rescue
end

RSpec.configure do |config|
  config.expect_with :rspec do |c|
    c.syntax = [ :should, :expect ]
  end
  config.mock_with :rspec do |c|
    c.syntax = [ :should, :expect ]
  end
  # tests to be excluded when under ssl
  if $ssl == '1'
    config.filter_run_excluding :ssl => true
  end
end

################################################################################
## cross rspec version compatibility tool: 
################################################################################
RSpec::Matchers.define :be_nil_or_empty do
 match do |actual|
   actual.nil? || actual.empty?
 end
end

class ArangoDB
  include HTTParty

  if $ssl == '1'
    base_uri "https://#{$address}"
  else
    base_uri "http://#{$address}"
  end 

  # set HTTP basic authorization
  basic_auth $user, $password

  # expect json as output/response format
  format :json

  # set timeout to 300 seconds - so we will see timeouts in the cluster with ther
  # respective error messages from the coordinator.
  default_timeout 300 

  # do not verify SSL
  default_options[:verify] = false

################################################################################
## adjust the global client-side timeout value
################################################################################

  def self.set_timeout (value) 
    old_value = default_options[:timeout] 
    default_options[:timeout] = value
    old_value
  end

  def self.set_read_timeout (value) 
    old_value = default_options[:read_timeout] 
    default_options[:read_timeout] = value
    old_value
  end
  
################################################################################
## create a collection
################################################################################

{'fraction_non_alphanumeric': 0.2918203514862226, 'fraction_numerical': 0.008244738555001085, 'mean_word_length': 5.114058355437666, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '346774', 'n_tokens_mistral': 1368, 'n_tokens_neox': 1282, 'n_words': 348}