Skip to content
Open
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
43 changes: 43 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Redis CI

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

jobs:
specs:
services:
redis:
image: redislabs/redismod
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 3
ports:
- 6379:6379

strategy:
fail-fast: false
matrix:
crystal_version:
- 1.2.0
- 1.3.0
- 1.4.1
- latest
experimental:
- false

runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@v3
- uses: crystal-lang/install-crystal@v1
with:
crystal: ${{matrix.crystal_version}}
- name: Install dependencies
run: shards install
- name: Run tests
run: crystal spec
2 changes: 1 addition & 1 deletion spec/graph_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private macro test(name, &block)
end

describe Redis::Graph do
redis = Redis::Client.new
redis = Redis::Client.new(uri: redis_uri())

test "creates and retrieves nodes" do
2.times do
Expand Down
2 changes: 1 addition & 1 deletion spec/json_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private macro test(name)
end

# redis = Redis::Cluster.new
redis = Redis::Client.new
redis = Redis::Client.new(uri: redis_uri())

describe Redis::JSON do
test "sets and gets JSON objects" do
Expand Down
9 changes: 3 additions & 6 deletions spec/redis_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ require "../src/redis"

# Do not use DB slot 15. That's used as the secondary DB for testing the ability
# to use DBs other than 0.
redis_uri = URI.parse("redis:///")
redis = Redis::Client.new(uri: redis_uri)
redis = Redis::Client.new(uri: redis_uri())

private def random_key
UUID.random.to_s
Expand Down Expand Up @@ -84,7 +83,6 @@ describe Redis::Client do
redis.incrby(key, 3).should eq 5
redis.decrby(key, 2).should eq 3
redis.incrby(key, 1234567812345678).should eq 1234567812345678 + 3

ensure
redis.del key
end
Expand Down Expand Up @@ -156,9 +154,9 @@ describe Redis::Client do
key = random_key

begin
first_incr = Redis::Future.new
first_incr = Redis::Future.new
second_incr = Redis::Future.new
first_decr = Redis::Future.new
first_decr = Redis::Future.new
second_decr = Redis::Future.new

redis.pipeline do |redis|
Expand Down Expand Up @@ -266,7 +264,6 @@ describe Redis::Client do
consumer_id = UUID.random.to_s

result = redis.xreadgroup group, consumer_id, count: "10", streams: {"my-stream": ">"}

rescue ex
pp ex
raise ex
Expand Down
2 changes: 1 addition & 1 deletion spec/search_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require "uuid"
require "../src/redis"
require "../src/search"

redis = Redis::Client.new
redis = Redis::Client.new(uri: redis_uri())

module Redis
describe FullText do
Expand Down
5 changes: 5 additions & 0 deletions spec/spec_helper.cr
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
require "spec"

# REDIS_URL for CI, redis:/// to run spec test locally
def redis_uri
URI.parse(ENV["REDIS_URL"]? || "redis:///")
end
2 changes: 1 addition & 1 deletion spec/time_series_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private macro test(name)
end
end

redis = Redis::Client.new
redis = Redis::Client.new(uri: redis_uri())

module Redis
describe TimeSeries do
Expand Down