Spec: less errors.
This commit is contained in:
parent
fbdb451f0e
commit
8a96c3302c
13
spec/test.cr
13
spec/test.cr
@ -4,6 +4,9 @@ require "file_utils"
|
|||||||
require "../src/dodb.cr"
|
require "../src/dodb.cr"
|
||||||
require "./test-data.cr"
|
require "./test-data.cr"
|
||||||
|
|
||||||
|
def fork_process(&)
|
||||||
|
Process.new Crystal::System::Process.fork { yield }
|
||||||
|
end
|
||||||
|
|
||||||
class DODB::SpecDataBase < DODB::DataBase(Ship)
|
class DODB::SpecDataBase < DODB::DataBase(Ship)
|
||||||
def initialize(storage_ext = "", remove_previous_data = true)
|
def initialize(storage_ext = "", remove_previous_data = true)
|
||||||
@ -223,7 +226,7 @@ describe "DODB::DataBase" do
|
|||||||
}.should be_true
|
}.should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
db_ships_by_class.get("does-not-exist").should eq [] of Ship
|
db_ships_by_class.get?("does-not-exist").should eq nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it "removes select elements from partitions" do
|
it "removes select elements from partitions" do
|
||||||
@ -409,7 +412,7 @@ describe "DODB::DataBase" do
|
|||||||
processes = [] of Process
|
processes = [] of Process
|
||||||
|
|
||||||
fork_count.times do |fork_id|
|
fork_count.times do |fork_id|
|
||||||
processes << Process.fork do
|
processes << fork_process do
|
||||||
entries_per_fork.times do |entry_id|
|
entries_per_fork.times do |entry_id|
|
||||||
db << Ship.new("entry-#{fork_id}-#{entry_id}", "???")
|
db << Ship.new("entry-#{fork_id}-#{entry_id}", "???")
|
||||||
end
|
end
|
||||||
@ -430,7 +433,7 @@ describe "DODB::DataBase" do
|
|||||||
# First pass, creating data.
|
# First pass, creating data.
|
||||||
processes = [] of Process
|
processes = [] of Process
|
||||||
fork_count.times do |fork_id|
|
fork_count.times do |fork_id|
|
||||||
processes << Process.fork do
|
processes << fork_process do
|
||||||
entries_per_fork.times do |entry_id|
|
entries_per_fork.times do |entry_id|
|
||||||
db << Ship.new("entry-#{fork_id}-#{entry_id}", "???")
|
db << Ship.new("entry-#{fork_id}-#{entry_id}", "???")
|
||||||
end
|
end
|
||||||
@ -441,7 +444,7 @@ describe "DODB::DataBase" do
|
|||||||
# Second pass, updating data.
|
# Second pass, updating data.
|
||||||
processes = [] of Process
|
processes = [] of Process
|
||||||
fork_count.times do |fork_id|
|
fork_count.times do |fork_id|
|
||||||
processes << Process.fork do
|
processes << fork_process do
|
||||||
entries_per_fork.times do |entry_id|
|
entries_per_fork.times do |entry_id|
|
||||||
db_entries_by_name.update Ship.new("entry-#{fork_id}-#{entry_id}", "???", tags: ["updated"])
|
db_entries_by_name.update Ship.new("entry-#{fork_id}-#{entry_id}", "???", tags: ["updated"])
|
||||||
end
|
end
|
||||||
@ -471,7 +474,7 @@ describe "DODB::DataBase" do
|
|||||||
|
|
||||||
processes = [] of Process
|
processes = [] of Process
|
||||||
fork_count.times do |fork_id|
|
fork_count.times do |fork_id|
|
||||||
processes << Process.fork do
|
processes << fork_process do
|
||||||
entries_per_fork.times do |entry_id|
|
entries_per_fork.times do |entry_id|
|
||||||
db_entries_by_name.safe_get "test" do |entry|
|
db_entries_by_name.safe_get "test" do |entry|
|
||||||
entry.klass = (entry.klass.to_i + 1).to_s
|
entry.klass = (entry.klass.to_i + 1).to_s
|
||||||
|
Loading…
Reference in New Issue
Block a user