Skip to content

Commit

Permalink
Merge pull request #186 from kurtzur/master
Browse files Browse the repository at this point in the history
Add health_tests table, and use in Gemstash::Health for idempotency
  • Loading branch information
smellsblue committed Jun 19, 2018
2 parents c090405 + 61ec795 commit 1142c9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/gemstash/health.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def self.check_db_read

def self.check_db_write
Gemstash::Env.current.db.transaction do
Gemstash::Env.current.db[:rubygems].insert(name: "health_check:fake_gem_name",
created_at: DateTime.now,
updated_at: DateTime.now)
health_tests = Gemstash::Env.current.db[:health_tests]
health_tests.truncate
health_tests.insert(string: "test_string")
# We don't want to actually write to the database
raise Sequel::Rollback
end
Expand Down
8 changes: 8 additions & 0 deletions lib/gemstash/migrations/04_health_tests.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Sequel.migration do
change do
create_table :health_tests do
primary_key :id
String :string
end
end
end

0 comments on commit 1142c9e

Please sign in to comment.