Skip to content

Commit

Permalink
Merge pull request #6 from wallarm/feature/EKB-1329-update-redis
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryBochkarev authored May 11, 2021
2 parents db9772a + de92490 commit f37b937
Show file tree
Hide file tree
Showing 24 changed files with 156 additions and 455 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ["2.3", "2.5.5", "2.6", "2.7", "3"]
redis-version: ["2.8", "5", "6"]

services:
redis:
image: redis:${{ matrix.redis-version }}
ports:
- 6379/tcp

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
env:
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
SKIP_JS_SPEC: true
SKIP_NOT_CORE: true
run: bundle exec rspec
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vagrant/

Gemfile.lock
*.gem
*~
.DS_STORE
Expand Down
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

28 changes: 0 additions & 28 deletions benchmarks/current_memory_usage.rb

This file was deleted.

26 changes: 26 additions & 0 deletions dip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "5.0"

compose:
files:
- ./docker-compose.yml

interaction:
ruby:
service: ruby
command: /bin/bash

sh:
service: ruby
command: /bin/bash

bundle:
service: ruby
command: bundle

rspec:
service: ruby
command: bundle exec rspec

provision:
- docker volume create --name bundler_data
- dip bundle install
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "2.1"
services:
ruby:
image: ruby:2.7
depends_on:
- redis
environment:
- BUNDLE_PATH=/bundle/2.7
- RACK_ENV=test
- REDIS_HOST=redis
- SKIP_JS_SPEC=true
volumes:
- .:/usr/src/qless
- bundler-data:/bundle
working_dir: /usr/src/qless
redis:
image: redis:6

volumes:
bundler-data:
external:
name: bundler_data
6 changes: 5 additions & 1 deletion exe/qless-config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ require 'thor'

class Configurator < Thor

class_option :redis, :default => 'redis://localhost:6379/0'
REDIS_HOST = ENV.fetch('REDIS_HOST', 'localhost')
REDIS_PORT = Integer(ENV.fetch('REDIS_PORT', '6379'))
REDIS_DB = Integer(ENV.fetch('REDIS_DB', '0'))

class_option :redis, :default => "redis://#{REDIS_HOST}:#{REDIS_PORT}/#{REDIS_DB}"

no_commands do
def qless
Expand Down
6 changes: 5 additions & 1 deletion exe/qless-stats
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ require 'thor'

class Stats < Thor

class_option :redis, :default => 'redis://localhost:6379/0'
REDIS_HOST = ENV.fetch('REDIS_HOST', 'localhost')
REDIS_PORT = Integer(ENV.fetch('REDIS_PORT', '6379'))
REDIS_DB = Integer(ENV.fetch('REDIS_DB', '0'))

class_option :redis, :default => "redis://#{REDIS_HOST}:#{REDIS_PORT}/#{REDIS_DB}"
class_option :interval, :type => :numeric, :default => 60,
:desc => 'Interval (in seconds) between stats collections'
class_option :count, :type => :numeric, :default => 0,
Expand Down
62 changes: 0 additions & 62 deletions lib/qless/middleware/memory_usage_monitor.rb

This file was deleted.

45 changes: 0 additions & 45 deletions lib/qless/middleware/metriks.rb

This file was deleted.

4 changes: 1 addition & 3 deletions qless.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ language-specific extension will also remain up to date.
s.test_files = s.files.grep(/^(test|spec|features)\//)
s.require_paths = ['lib']

s.add_dependency 'metriks', '>= 0.9'
s.add_dependency 'redis', '>= 4.0'
s.add_dependency 'rusage', '>= 0.2.0'
s.add_dependency 'redis', ['>= 4.0']
s.add_dependency 'sinatra', '>= 1.3'
s.add_dependency 'statsd-ruby', '>= 1.3'
s.add_dependency 'thin', '>= 1.6'
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ module Qless
end
end
end
end.tap { |t| t.join(0.01) }
end.tap { |t| t.join(0.1) }
end

# Wait until all the threads have sent their events
def jids_for_event(event)
thread.join(0.1)
thread.join(0.3)
events[event]
end

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/exe/qless_stats_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

require 'spec_helper'

describe 'qless-stats', :integration do
describe 'qless-stats', :integration, :not_core do
let(:path) { './exe/qless-stats' }

def run(*args)
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class NoPerformJob; end
queue.put('Foo', {}, jid: 'c', depends: ['a'])
expect(client.jobs['c'].dependencies).to eq(['a'])
client.jobs['c'].depend('b')
expect(client.jobs['c'].dependencies).to eq(%w{a b})
expect(client.jobs['c'].dependencies).to match_array(%w{a b})
client.jobs['c'].undepend('a')
expect(client.jobs['c'].dependencies).to eq(['b'])
end
Expand Down Expand Up @@ -355,7 +355,7 @@ def self.perform(job)
end

it 'exposes when the next job will run' do
pending('This is implemented only in the python client')
skip('This is implemented only in the python client')
queue.recur('Foo', {}, 60, jid: 'jid')
nxt = client.jobs['jid'].next
queue.pop
Expand Down
Loading

0 comments on commit f37b937

Please sign in to comment.