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

hold on for redis #1834

Closed
wants to merge 3 commits into from
Closed
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
16 changes: 14 additions & 2 deletions contrib/ruby_event_store-flipper/spec/flipper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ module RubyEventStore
specify "enabling toggle for actor" do
Flipper.enable(event_store)

actor = OpenStruct.new(flipper_id: "User:123")
actor = mk_actor

flipper.enable_actor(:foo_bar, actor)

expect(event_store).to have_published(
Expand All @@ -88,7 +89,7 @@ module RubyEventStore
specify "disabling toggle for actor" do
Flipper.enable(event_store)

actor = OpenStruct.new(flipper_id: "User:123")
actor = mk_actor
flipper.disable_actor(:foo_bar, actor)

expect(event_store).to have_published(
Expand Down Expand Up @@ -189,6 +190,17 @@ module RubyEventStore

instrumenter.instrument("feature_operation.flipper", operation: :enabled?, feature_name: "foo_bar")
instrumenter.instrument("feature_operation.flipper", operation: :exist?, feature_name: "foo_bar")

private

def mk_actor
Class
.new do
def flipper_id
"User:123"
end
end
.new
end
end
end
15 changes: 13 additions & 2 deletions support/nix/redis.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@ mkShell {
--daemonize yes \
--pidfile $PIDFILE

export REDIS_URL="unix://$SOCKET"
if [ $? -eq 0 ]; then
echo "Redis server started successfully."
export REDIS_URL="unix://$SOCKET"
else
echo "Failed to start Redis server. Check logs or permissions."
exit 1
fi

pushtrap "kill -9 $(cat $PIDFILE);rm -rf $TMP" EXIT
if [ ! -f "$PIDFILE" ]; then
echo "Redis PID file not found. Starting failed?"
exit 1
fi

pushtrap "if [ -f $PIDFILE ]; then kill -9 $(cat $PIDFILE); fi; rm -rf $TMP" EXIT
'';
}
Loading