Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to github workflows #104

Merged
merged 7 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]
ameykusurkar marked this conversation as resolved.
Show resolved Hide resolved

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
Loading