From 24f007d6409239fe8965c9e4a91009edde0e0b0f Mon Sep 17 00:00:00 2001 From: Karol Chrapek Date: Thu, 23 May 2024 13:32:44 +0200 Subject: [PATCH] Correct naming and remove spare comment --- lib/kennel/models/slo.rb | 6 +++--- test/kennel/models/slo_test.rb | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/kennel/models/slo.rb b/lib/kennel/models/slo.rb index c6aabe3..cf27aee 100644 --- a/lib/kennel/models/slo.rb +++ b/lib/kennel/models/slo.rb @@ -14,7 +14,7 @@ class Slo < Record thresholds: [] }.freeze - settings :type, :description, :thresholds, :query, :tags, :monitor_ids, :monitor_tags, :name, :groups, :sliSpecification + settings :type, :description, :thresholds, :query, :tags, :monitor_ids, :monitor_tags, :name, :groups, :sli_specification defaults( tags: -> { @project.tags }, @@ -35,8 +35,8 @@ def build_json type: type ) - if type == 'time_slice' && v = sliSpecification - data[:sliSpecification] = v + if type == 'time_slice' + data[:sliSpecification] = :sli_specification elsif v = query data[:query] = v end diff --git a/test/kennel/models/slo_test.rb b/test/kennel/models/slo_test.rb index d37c931..1292da4 100644 --- a/test/kennel/models/slo_test.rb +++ b/test/kennel/models/slo_test.rb @@ -11,7 +11,6 @@ class TestSlo < Kennel::Models::Slo def slo(options = {}) Kennel::Models::Slo.new( - # Determine the type from options or default to "metric" type = options[:type] || "metric" options.delete(:project) || project, slo_options ={ @@ -19,7 +18,6 @@ def slo(options = {}) name: -> { "Foo" }, kennel_id: -> { "m1" } } - # Conditionally include sliSpecification if type is "time_slice" slo_options[:sliSpecification] = -> { options[:sliSpecification] } if type == "time_slice" Kennel::Models::Slo.new(project, slo_options.merge(options)) ) @@ -85,7 +83,7 @@ def slo(options = {}) expected_basic_json[:sliSpecification] = sli_spec assert_json_equal( - slo(type: "time_slice", sliSpecification: sli_spec).build_json, + slo(type: "time_slice", sli_specification: sli_spec).build_json, expected_basic_json ) end