-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test that constants are available in candidates
277 runs, 500 assertions, 26 failures, 0 errors, 0 skips Apparently there are some kinks to work out.
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
semantic_conventions/test/opentelemetry/semantic_conventions/attributes_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
require 'test_helper' | ||
|
||
OLD_SEMCONV_ROOTS = %i[Resource Trace].freeze | ||
|
||
describe OpenTelemetry::SemanticConventions do | ||
OLD_SEMCONV_ROOTS | ||
.each do |old_root| | ||
describe "old root #{old_root} has a corresponding SemanticCandidates namespace and constant" do | ||
OpenTelemetry::SemanticConventions | ||
.const_get(old_root) | ||
.constants | ||
.each do |const| | ||
it "(#{const})" do | ||
root_namespace = const.to_s.split('_').first | ||
assert OpenTelemetry::SemanticCandidates.constants.include?(root_namespace.to_sym), "Missing candidate namespace: #{root_namespace}" | ||
|
||
candidate_namespace = OpenTelemetry::SemanticCandidates.const_get(root_namespace.to_sym) | ||
assert candidate_namespace.constants.include?(const), "Missing candidate constant: #{const}" | ||
end | ||
end | ||
end | ||
end | ||
|
||
OpenTelemetry::SemanticConventions | ||
.constants | ||
.reject { |const| const == :VERSION } | ||
.reject { |root_namespace| OLD_SEMCONV_ROOTS.include?(root_namespace) } | ||
.each do |root_namespace| | ||
describe "stable root (#{root_namespace})" do | ||
OpenTelemetry::SemanticConventions | ||
.const_get(root_namespace) | ||
.constants | ||
.each do |stable_const| | ||
it "(#{stable_const})" do | ||
candidate_namespace = OpenTelemetry::SemanticCandidates.const_get(root_namespace) | ||
assert candidate_namespace.constants.include?(stable_const), "Missing stable constant in candidates: #{stable_const}" | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if RUBY_ENGINE == 'ruby' | ||
require 'simplecov' | ||
SimpleCov.start | ||
SimpleCov.minimum_coverage 85 | ||
end | ||
|
||
require 'minitest/autorun' | ||
require 'pry' | ||
|
||
Dir[File.join(File.dirname(__FILE__), '..', 'lib', 'opentelemetry', '**', '*.rb')].sort.each { |file| require file } |