Sha256: 60562a6d7911dcc40c0c8a8997b9f0c960c6221356c6ce5e56dbaea45c0a16e2

Contents?: true

Size: 464 Bytes

Versions: 5

Compression:

Stored size: 464 Bytes

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

def with_env(new_env)
  env_to_reset = ENV.select { |k, _| new_env.key?(k) }
  keys_to_delete = new_env.keys - ENV.keys
  new_env.each_pair { |k, v| ENV[k] = v }
  yield
ensure
  env_to_reset.each_pair { |k, v| ENV[k] = v }
  keys_to_delete.each { |k| ENV.delete(k) }
end

def exportable_timestamp(time = Time.now)
  (time.to_r * 1_000_000_000).to_i
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opentelemetry-common-0.19.3 lib/opentelemetry/common/test_helpers.rb
opentelemetry-common-0.19.2 lib/opentelemetry/common/test_helpers.rb
opentelemetry-common-0.19.1 lib/opentelemetry/common/test_helpers.rb
opentelemetry-common-0.19.0 lib/opentelemetry/common/test_helpers.rb
opentelemetry-common-0.18.0 lib/opentelemetry/common/test_helpers.rb