mirror of
https://github.com/inspec/inspec
synced 2024-09-21 06:51:56 +00:00
Update Collector#reset to clear telemetry_toggled_off
Updated the name of #reset -> #reset! as we are modifying state of a singeton. Signed-off-by: Miah Johnson <miah@chia-pet.org>
This commit is contained in:
parent
871b0e9a38
commit
d000f20f34
3 changed files with 6 additions and 4 deletions
|
@ -64,9 +64,11 @@ module Inspec::Telemetry
|
|||
end
|
||||
|
||||
# Blanks the contents of the data series collection.
|
||||
# Reset telemetry toggle
|
||||
# @return [True]
|
||||
def reset
|
||||
def reset!
|
||||
@data_series = []
|
||||
@telemetry_toggled_off = false
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -4,7 +4,7 @@ require_relative '../../../helper.rb'
|
|||
class TestTelemetryCollector < Minitest::Test
|
||||
def setup
|
||||
@collector = Inspec::Telemetry::Collector.instance
|
||||
@collector.reset
|
||||
@collector.reset!
|
||||
end
|
||||
|
||||
def test_collector_singleton
|
||||
|
@ -37,7 +37,7 @@ class TestTelemetryCollector < Minitest::Test
|
|||
def test_reset_singleton
|
||||
data_series = Inspec::Telemetry::DataSeries.new('/resource/File')
|
||||
@collector.add_data_series(data_series)
|
||||
@collector.reset
|
||||
@collector.reset!
|
||||
assert_equal 0, @collector.list_data_series.count
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ class TestTelemetryGlobalMethods < Minitest::Test
|
|||
def setup
|
||||
@collector = Inspec::Telemetry::Collector.instance
|
||||
@collector.load_config(Inspec::Config.mock('enable_telemetry'=>true))
|
||||
@collector.reset
|
||||
@collector.reset!
|
||||
end
|
||||
|
||||
def test_record_telemetry_data
|
||||
|
|
Loading…
Reference in a new issue