1. nuclon
  2. qless-perl

Commits

nuclon  committed 476a3be

Added a test

  • Participants
  • Parent commits b1dc722
  • Branches default

Comments (0)

Files changed (2)

File META.yml

----
-abstract: 'perl bind for Qless job queueing system'
-author:
-  - 'qless, qless-py and qless-core - SEOmoz'
-build_requires:
-  ExtUtils::MakeMaker: 6.36
-  Test::Class: 0
-  Test::More: 0
-configure_requires:
-  ExtUtils::MakeMaker: 6.36
-distribution_type: module
-dynamic_config: 1
-generated_by: 'Module::Install version 1.06'
-license: unknown
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
-name: Qless
-no_index:
-  directory:
-    - inc
-    - share
-    - t
-requires:
-  Class::Load: 0
-  File::ShareDir: 0
-  JSON::XS: 0
-  Redis: 0
-  Time::HiRes: 0
-version: 0.01

File t/lib/TestQless/General.pm

View file
 
 }
 
+# Despite the wordy test name, we want to make sure that
+# when a job is put with a delay, that its state is 
+# 'scheduled', when we peek it or pop it and its state is
+# now considered valid, then it should be 'waiting'
+sub test_scheduled_peek_pop_state : Tests {
+	my $self = shift;
+	my $jid = $self->{'q'}->put('Qless::Job', {'test'=>'scheduled_state'}, delay => 10);
+	is $self->{'client'}->jobs($jid)->state, 'scheduled';
+
+	sleep(11);
+
+	is $self->{'q'}->peek->state, 'waiting';
+	is $self->{'client'}->jobs($jid)->state, 'waiting';
+}
+
 
 1;