Sha256: 42ae23fead936c73553400009677b4b5051025a6636eb023dcf1f51130420f3d

Contents?: true

Size: 1.42 KB

Versions: 18

Compression:

Stored size: 1.42 KB

Contents

module Instana
  class Test
    class << self
      # Used at the start of the test suite to configure required environment
      # variables (if missing)
      #
      def setup_environment
        # Set defaults if not set
        ENV['MEMCACHED_HOST']     ||= '127.0.0.1:11211'
        ENV['TRAVIS_PSQL_HOST']   ||= "127.0.0.1"
        ENV['TRAVIS_PSQL_USER']   ||= "postgres"
        ENV['TRAVIS_MYSQL_HOST']  ||= "127.0.0.1"
        ENV['TRAVIS_MYSQL_USER']  ||= "root"

        if !ENV.key?('DATABASE_URL')
          if ENV['DB_FLAVOR'] == 'postgresql'
            ENV['DATABASE_URL'] = "postgresql://#{ENV['TRAVIS_PSQL_USER']}:#{ENV['TRAVIS_PSQL_PASS']}@#{ENV['TRAVIS_PSQL_HOST']}:5432/travis_ci_test"
          elsif ENV['DB_FLAVOR'] == 'mysql'
            ENV['DATABASE_URL'] = "mysql://#{ENV['TRAVIS_MYSQL_USER']}:#{ENV['TRAVIS_MYSQL_PASS']}@#{ENV['TRAVIS_MYSQL_HOST']}:3306/travis_ci_test"
          else
            ENV['DB_FLAVOR'] ||= 'mysql2'
            ENV['DATABASE_URL'] = "mysql2://#{ENV['TRAVIS_MYSQL_USER']}:#{ENV['TRAVIS_MYSQL_PASS']}@#{ENV['TRAVIS_MYSQL_HOST']}:3306/travis_ci_test"
          end
        end

        Instana.logger.warn "Database connect string configured to: #{ENV['DATABASE_URL']}"
      end

      def postgresql?
        ENV['DB_FLAVOR'] == 'postgresql'
      end

      def mysql2?
        ENV['DB_FLAVOR'] == 'mysql2'
      end

      def mysql?
        ENV['DB_FLAVOR'] == 'mysql'
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
instana-1.11.6 lib/instana/test.rb
instana-1.11.6-java lib/instana/test.rb
instana-1.11.5 lib/instana/test.rb
instana-1.11.5-java lib/instana/test.rb
instana-1.11.4-java lib/instana/test.rb
instana-1.11.4 lib/instana/test.rb
instana-1.11.3-java lib/instana/test.rb
instana-1.11.3 lib/instana/test.rb
instana-1.11.2-java lib/instana/test.rb
instana-1.11.2 lib/instana/test.rb
instana-1.11.1-java lib/instana/test.rb
instana-1.11.1 lib/instana/test.rb
instana-1.11.0-java lib/instana/test.rb
instana-1.11.0 lib/instana/test.rb
instana-1.10.10 lib/instana/test.rb
instana-1.10.10-java lib/instana/test.rb
instana-1.10.9-java lib/instana/test.rb
instana-1.10.9 lib/instana/test.rb