• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2015 gRPC authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15spec_dir = File.expand_path(File.dirname(__FILE__))
16root_dir = File.expand_path(File.join(spec_dir, '..'))
17lib_dir = File.expand_path(File.join(root_dir, 'lib'))
18
19$LOAD_PATH.unshift(spec_dir)
20$LOAD_PATH.unshift(lib_dir)
21$LOAD_PATH.uniq!
22
23# set up coverage
24require 'simplecov'
25SimpleCov.start do
26  add_filter 'spec'
27  add_filter 'bin'
28  SimpleCov.command_name ENV['COVERAGE_NAME']
29end if ENV['COVERAGE_NAME']
30
31require 'rspec'
32require 'logging'
33require 'rspec/logging_helper'
34require 'grpc'
35
36require_relative 'support/services'
37require_relative 'support/helpers'
38
39# GRPC is the general RPC module
40#
41# Configure its logging for fine-grained log control during test runs
42module GRPC
43  extend Logging.globally
44end
45Logging.logger.root.appenders = Logging.appenders.stdout
46Logging.logger.root.level = :info
47Logging.logger['GRPC'].level = :info
48Logging.logger['GRPC::ActiveCall'].level = :info
49Logging.logger['GRPC::BidiCall'].level = :info
50
51# Configure RSpec to capture log messages for each test. The output from the
52# logs will be stored in the @log_output variable. It is a StringIO instance.
53RSpec.configure do |config|
54  include RSpec::LoggingHelper
55  config.capture_log_messages  # comment this out to see logs during test runs
56  include GRPC::Spec::Helpers
57end
58
59RSpec::Expectations.configuration.warn_about_potential_false_positives = false
60
61Thread.abort_on_exception = true
62