public void CanClearFailedJobs() { Job.create("jobs", "resque.BadJob"); worker.work(0); Assert.AreEqual(1, Resque.failure.count()); Resque.failure.clear(); Assert.AreEqual(0, Resque.failure.count()); }
public void CanReQueueJobs() { Job.create("jobs", "resque.DummyJob", 20, "/tmp"); Job job = Resque.Reserve("jobs"); job.recreate(); Assert.That(job, Is.EqualTo(Resque.Reserve("jobs"))); }
public void CatchesExceptionalJobs() { Job.create("jobs", "resque.BadJob"); Job.create("jobs", "resque.BadJob"); worker.work(0); worker.work(0); worker.work(0); Assert.AreEqual(2, Resque.failure.count()); }
public void ProcesesAllQueuesInAlphabeticalOrder() { Job.create("high", "resque.GoodJob"); Job.create("critical", "resque.GoodJob"); Job.create("blahblah", "resque.GoodJob"); worker = new Worker("*"); //worker.work(0, (List<String> queueList) => { int a; }); }
public void CanGrabJobsOffAQueue() { //Job.create("jobs", "dummy-job", 20, "/tmp"); FIXME NEED TO DEAL WITH THIS Job.create("jobs", "resque.DummyJob", 20, "/tmp"); Job job = Resque.Reserve("jobs"); Assert.AreEqual("resque.DummyJob", job.PayloadClass().FullName); var num = job.args()[0]; Assert.AreEqual(20, num); Assert.That("/tmp", Is.EqualTo(job.args()[1])); }
public void CanWorkOnMultipleQueues() { Job.create("high", "resque.GoodJob"); Job.create("critical", "resque.GoodJob"); worker = new Worker(new string[] { "critical", "high" }); worker.process(); Assert.AreEqual(Resque.size("high"), 1); Assert.AreEqual(Resque.size("critical"), 0); worker.process(); Assert.AreEqual(Resque.size("high"), 0); }
public void CanPeekAtFailedJobs() { for (int i = 0; i < 10; i++) { Job.create("jobs", "resque.BadJob"); } worker.work(0); Assert.AreEqual(10, Resque.failure.count()); Byte[][] b = null; Assert.AreEqual(Resque.failure.all().Length, 10); }
public void CanTestForEquality() { Assert.IsTrue(Job.create("jobs", "resque.DummyJob", 20, "/tmp")); Assert.IsTrue(Job.create("jobs", "resque.DummyJob", 20, "/tmp")); //Assert.IsTrue(Job.create("jobs", "dummy-job", 20, "/tmp")); NEED TO MAKE THIS WORK Assert.That(Resque.Reserve("jobs"), Is.EqualTo(Resque.Reserve("jobs"))); Assert.IsTrue(Job.create("jobs", "resque.NotDummyJob", 20, "/tmp")); Assert.IsTrue(Job.create("jobs", "resque.DummyJob", 20, "/tmp")); Assert.That(Resque.Reserve("jobs"), Is.Not.EqualTo(Resque.Reserve("jobs"))); Assert.IsTrue(Job.create("jobs", "resque.DummyJob", 20, "/tmp")); Assert.IsTrue(Job.create("jobs", "resque.DummyJob", 30, "/tmp")); Assert.That(Resque.Reserve("jobs"), Is.Not.EqualTo(Resque.Reserve("jobs"))); }
public static bool enqueue(string className, params object[] args) { Type workerType = Type.GetType(className); System.Reflection.MethodInfo methodInfo = workerType.GetMethod("queue", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.FlattenHierarchy); if (methodInfo == null) { throw new NoQueueError(); } string queue = (string)methodInfo.Invoke(null, null); if (String.IsNullOrEmpty(queue)) { throw new NoQueueError(); } return(Job.create(queue, className, args)); }
public void CanWorkOnAllQueues() { Job.create("high", "resque.GoodJob"); Job.create("critical", "resque.GoodJob"); Job.create("blahblah", "resque.GoodJob"); worker = new Worker("*"); worker.work(0); Console.WriteLine(Resque.size("high")); Console.WriteLine(Resque.size("critical")); Console.WriteLine(Resque.size("blahblah")); Assert.AreEqual(Resque.size("high"), 0); Assert.AreEqual(Resque.size("critical"), 0); Assert.AreEqual(Resque.size("blahblah"), 0); }
public void recreate() { Job.create(queue, PayloadClass().FullName, args().ToArray()); }
public void CanAskResqueForQueueSize() { Assert.That(0, Is.EqualTo(Resque.size("a_queue"))); Job.create("a_queue", "resque.DummyJob", 1, "asdf"); Assert.That(1, Is.EqualTo(Resque.size("a_queue"))); }
public void CanPutJobsOnAQueue() { Assert.IsTrue(Job.create("jobs", "DummyJob", 20, "/tmp")); Assert.IsTrue(Job.create("jobs", "DummyJob", 20, "/tmp")); }
internal void TryToCreateJobWithNoClassName() { Job.create("jobs", null); }
public void KeepsStats() { Job.create("jobs", "resque.DummyJob", 20, "/tmp"); }