class StartupTime::Registry
StartupTime::Registry
- an interface to the tests configured in resources/tests.yaml
Constants
- GROUPS
map each group (e.g. “jvm”) to an array of its member IDs (e.g. [“java”, “kotlin”, “scala”])
- TESTS
the top-level hash in tests.yaml. keys are test IDs (e.g. “ruby”); values are test specs
- TEST_DATA
the path to the test configuration file
Public Class Methods
a hash which maps test IDs (e.g. “scala”) to their corresponding group names (e.g. [“compiled”, “jvm”, “slow”])
# File lib/startup_time/registry.rb, line 39 def self.ids_to_groups(format: :ascii) if format == :json TESTS.entries.each_with_object({}) do |(id, test), target| target[id] = test[:groups].sort end else # ASCII TESTS.entries.map { |id, test| [id, test[:groups].sort.join(', ')] } end end
# File lib/startup_time/registry.rb, line 49 def initialize @omit = Set.new @only = Set.new end
Public Instance Methods
add the specified test(s) to the set of disabled tests
# File lib/startup_time/registry.rb, line 55 def omit(id) @omit.merge(ids_for(id)) end
add the specified test(s) to the set of enabled tests
# File lib/startup_time/registry.rb, line 60 def only(id) @only.merge(ids_for(id)) end
the subset of candidate tests which satisfy the `only` and `omit` criteria
# File lib/startup_time/registry.rb, line 65 def selected_tests only = !@only.empty? ? @only : TESTS.keys.to_set test_ids = (only - @omit).to_a TESTS.slice(*test_ids) end
Private Instance Methods
takes a test ID or group ID and resolves it into its corresponding test IDs. if it's already a test ID, it's wrapped in an array; otherwise, an array of test IDs belonging to the group is returned.
# File lib/startup_time/registry.rb, line 76 def ids_for(id) if TESTS[id] ids = [id] elsif GROUPS.key?(id) ids = GROUPS[id] else abort "Can't resolve IDs for: #{id.inspect}" end ids end