Skip to content

Commit

Permalink
Merge pull request #104 from gocardless/add-github-workflows
Browse files Browse the repository at this point in the history
Move to github workflows
  • Loading branch information
ankithads authored Jul 4, 2024
2 parents 0ea7359 + c79a2f7 commit 066cc01
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 64 deletions.
59 changes: 0 additions & 59 deletions .circleci/config.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: tests

on:
push:

jobs:
rspec:
strategy:
fail-fast: false
matrix:
ruby_version: ["3.0", "3.1", "3.2", "3.3"]

runs-on: ubuntu-latest
services:
postgres:
image: postgres:14.2
env:
POSTGRES_DB: que-test
POSTGRES_USER: ubuntu
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
PGDATABASE: que-test
PGUSER: ubuntu
PGPASSWORD: password
PGHOST: localhost
BUNDLE_RUBYGEMS__PKG__GITHUB__COM: gocardless-robot-readonly:${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: "${{ matrix.ruby-version }}"
- name: Run specs
run: |
bundle exec rspec
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ group :test do
end

gem 'prometheus-client', '~> 1.0'
gem 'prometheus_gcstat', git: '[email protected]:gocardless/prometheus_gcstat_ruby'

source "https://rubygems.pkg.github.com/gocardless" do
gem "prometheus_gcstat"
end
gemspec
10 changes: 8 additions & 2 deletions spec/lib/que/locker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,14 @@ def expect_to_lock_with(cursor:)
context "with non-zero cursor expiry" do
let(:cursor_expiry) { 5 }

before { allow(locker).to receive(:monotonic_now) { @epoch } }

before do
# we need this to avoid flakiness during resetting the cursor.
# Cursors are reset in the beginning when the locker class object is created.
# It is reset in handle_expired_cursors! method. Sometimes the execution is fast enough that
# the condition to reset is not met because the Process.clock_gettime remains same(monotonic_now method).
locker.instance_variable_get(:@queue_expires_at)[queue] = Process.clock_gettime(Process::CLOCK_MONOTONIC) + cursor_expiry
allow(locker).to receive(:monotonic_now) { @epoch }
end
# This test simulates the repeated locking of jobs. We're trying to prove that
# the locker will use the previous jobs ID as a cursor until the expiry has
# elapsed, after which we'll reset.
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/que/middleware/queue_collector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

RSpec.describe Que::Middleware::QueueCollector do
subject(:collector) { described_class.new(->(_env) { nil }, options) }
let(:options) { {} }
let(:options) { {refresh_interval: 0.1.second} }
let(:now) { postgres_now }
let(:due_now_delay) { 1000.0 }
let(:due_later_than_now_delay) { due_now_delay / 2 }
Expand Down

0 comments on commit 066cc01

Please sign in to comment.