Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Commit

Permalink
Got all tests passing again after resolving comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederick Ross committed Feb 6, 2013
1 parent c06c51e commit 89a42e6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/splunk-sdk-ruby/collection/configuration_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class ConfigurationFile < Collection # :nodoc:
# This class is unusual: it is the element of a collection itself,
# and its elements are entities.

def initialize(service, name, namespace)
def initialize(service, name, namespace=nil)
super(service, ["configs", "conf-#{name}"], entity_class=Stanza)
@name = name
@namespace = namespace
@namespace = namespace || service.namespace
end

def create(name, args={})
Expand Down
6 changes: 4 additions & 2 deletions lib/splunk-sdk-ruby/entity/saved_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ def update(args) # :nodoc:
# field on args if it's not already set. This, of course, has a race
# condition if someone else has set the search since the last time the
# entity was refreshed.
need_search = @state["content"]["eai:attributes"]["requiredFields"].has_key?("search")
if needs_search && !args.has_key?(:search) && !args.has_key?("search")
#
# It would be nice to check if "search" is in the requiredFields list
# on the entity, but that isn't always returned
if !args.has_key?(:search) && !args.has_key?("search")
args[:search] = fetch("search")
end
super(args)
Expand Down
10 changes: 8 additions & 2 deletions test/test_jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ def test_enable_preview
begin
install_app_from_collection("sleep_command")
job = @service.jobs.create("search index=_internal | sleep 2 | join [sleep 2]")
while !job.is_ready?()
sleep(0.1)
end
assert_equal("0", job["isPreviewEnabled"])
job.enable_preview()
assert_eventually_true(1000) do
Expand All @@ -192,12 +195,15 @@ def setup

install_app_from_collection("sleep_command")
@job = @service.jobs.create("search index=_internal | sleep 20")
while !@job.is_ready?()
sleep(0.1)
end
end

def teardown
if @job
@job.cancel()
assert_eventually_true() do
assert_eventually_true(50) do
!@service.jobs.has_key?(@job.sid)
end
end
Expand Down Expand Up @@ -263,7 +269,7 @@ def test_set_priority
sleep(1)
new_priority = 3
@job.set_priority(new_priority)
assert_eventually_true(10) do
assert_eventually_true(50) do
@job.refresh()
fail("Job finished before priority was set.") if @job.is_done?()
@job["priority"] == "3"
Expand Down

0 comments on commit 89a42e6

Please sign in to comment.