New Upstream Snapshot - ruby-wait-for-it
Ready changes
Summary
Merged new upstream version: 0.2.1+git20220731.1.695b2cd (was: 0.2.1).
Resulting package
Built on 2023-01-19T07:25 (took 4m2s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots ruby-wait-for-it
Lintian Result
Diff
diff --git a/.github/workflows/check_changelog.yml b/.github/workflows/check_changelog.yml
deleted file mode 100644
index bf31094..0000000
--- a/.github/workflows/check_changelog.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-name: Check Changelog
-
-
-on: [pull_request]
-
-jobs:
- build:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v1
- - name: Check that CHANGELOG is touched
- run: |
- cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
-
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 0cb6eeb..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-/.bundle/
-/.yardoc
-/Gemfile.lock
-/_yardoc/
-/coverage/
-/doc/
-/pkg/
-/spec/reports/
-/tmp/
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index da2583a..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: ruby
-rvm:
- - 2.2
- - 2.5
- - 2.6
- - 2.7
-before_install: gem install bundler -v 1.11.2
diff --git a/Rakefile b/Rakefile
index b7e9ed5..b09bf2e 100644
--- a/Rakefile
+++ b/Rakefile
@@ -4,3 +4,4 @@ require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
+task :test => :spec
diff --git a/debian/changelog b/debian/changelog
index db36e76..f78c915 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ruby-wait-for-it (0.2.1+git20220731.1.695b2cd-1) UNRELEASED; urgency=low
+
+ * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk> Thu, 19 Jan 2023 07:22:39 -0000
+
ruby-wait-for-it (0.2.1-2) unstable; urgency=medium
* Source only upload for testing migration
diff --git a/lib/wait_for_it.rb b/lib/wait_for_it.rb
index 21cc67b..55bd1c2 100644
--- a/lib/wait_for_it.rb
+++ b/lib/wait_for_it.rb
@@ -72,12 +72,12 @@ class WaitForIt
#
# @param [String] command Command to spawn
# @param [Hash] options
- # @options options [Fixnum] :timeout The duration to wait a commmand to boot, default is 10 seconds
- # @options options [String] :wait_for The output the process emits when it has successfully booted.
+ # @option options [Fixnum] :timeout The duration to wait a commmand to boot, default is 10 seconds
+ # @option options [String] :wait_for The output the process emits when it has successfully booted.
# When present the calling process will block until the message is received in the log output
# or until the timeout is hit.
- # @options options [String] :redirection The shell redirection used to pipe to log file
- # @options options [Hash] :env Keys and values for environment variables in the process
+ # @option options [String] :redirection The shell redirection used to pipe to log file
+ # @option options [Hash] :env Keys and values for environment variables in the process
def initialize(command, options = {})
@command = command
@timeout = options[:timeout] || WaitForIt.timeout
diff --git a/spec/fixtures/fixture_helper.rb b/spec/fixtures/fixture_helper.rb
new file mode 100644
index 0000000..f6228ad
--- /dev/null
+++ b/spec/fixtures/fixture_helper.rb
@@ -0,0 +1 @@
+$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
diff --git a/spec/fixtures/never_exits.rb b/spec/fixtures/never_exits.rb
new file mode 100644
index 0000000..17c493d
--- /dev/null
+++ b/spec/fixtures/never_exits.rb
@@ -0,0 +1,8 @@
+STDOUT.sync = true
+
+puts "booted"
+
+while true
+ puts "running"
+ sleep 1
+end
diff --git a/spec/fixtures/sleep.rb b/spec/fixtures/sleep.rb
new file mode 100644
index 0000000..5bf654d
--- /dev/null
+++ b/spec/fixtures/sleep.rb
@@ -0,0 +1,7 @@
+STDOUT.sync = true
+
+puts "Started"
+val = ENV["SLEEP"].to_i
+sleep val
+puts "slept for #{val}"
+puts "Done"
\ No newline at end of file
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000..742ccb2
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,9 @@
+$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
+require 'wait_for_it'
+
+
+def fixture_path(name = nil)
+ path = Pathname.new(File.expand_path("../fixtures", __FILE__))
+ path = path.join(name) if name
+ path
+end
diff --git a/spec/wait_for_it_spec.rb b/spec/wait_for_it_spec.rb
new file mode 100644
index 0000000..ebc80d6
--- /dev/null
+++ b/spec/wait_for_it_spec.rb
@@ -0,0 +1,70 @@
+require 'spec_helper'
+
+describe WaitForIt do
+ it 'has a version number' do
+ expect(WaitForIt::VERSION).not_to be nil
+ end
+
+ it "sends TERM to child on exit" do
+ options = { wait_for: "booted" }
+
+ WaitForIt.new("ruby #{ fixture_path("never_exits.rb") }", options) do |spawn|
+ spawn.send(:shutdown)
+ count_before = spawn.count("running")
+ sleep 1
+ count_after = spawn.count("running")
+ expect(count_before).to eq(count_after)
+ end
+ end
+
+ it "raises an error if a process takes too long to boot" do
+ expect {
+ options = { timeout: 1, env: { SLEEP: 10 }, wait_for: "Done" }
+ WaitForIt.new("ruby #{ fixture_path("sleep.rb") }", options) do |spawn|
+ # never gets here
+ end
+ }.to raise_error(WaitForIt::WaitForItTimeoutError)
+ end
+
+ it "counts" do
+ options = { env: { SLEEP: 0 }, wait_for: "Done" }
+ WaitForIt.new("ruby #{ fixture_path("sleep.rb") }", options) do |spawn|
+ expect(spawn.count("slept for 0")).to eq(1)
+ expect(spawn.count("foo")).to eq(0)
+ end
+ end
+
+ it "wait does not raise an error" do
+ options = { env: { SLEEP: 0 }, wait_for: "Done" }
+ WaitForIt.new("ruby #{ fixture_path("sleep.rb") }", options) do |spawn|
+ expect(spawn.wait("foo", 1)).to eq(false)
+ expect(spawn.wait("Done", 1)).to be_truthy
+ end
+ end
+
+ it "contains?" do
+ options = { env: { SLEEP: 0 }, wait_for: "Done" }
+ WaitForIt.new("ruby #{ fixture_path("sleep.rb") }", options) do |spawn|
+ expect(spawn.contains?("Started")).to be_truthy
+ expect(spawn.contains?("foo")).to be_falsey
+ end
+ end
+
+ describe 'wait!' do
+ it 'raises if process takes too long too long' do
+ expect {
+ options = { env: { SLEEP: 100 }, wait_for: "Started"}
+ WaitForIt.new("ruby #{ fixture_path("sleep.rb") }", options) do |spawn|
+ spawn.wait!("Done", 1)
+ end
+ }.to raise_error(WaitForIt::WaitForItTimeoutError)
+ end
+
+ it 'does not raise an error' do
+ options = { env: { SLEEP: 3 }, wait_for: "Started"}
+ WaitForIt.new("ruby #{ fixture_path("sleep.rb") }", options) do |spawn|
+ spawn.wait!("Done", 10)
+ end
+ end
+ end
+end
Debdiff
File lists identical (after any substitutions)
No differences were encountered in the control files