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
5 changes: 1 addition & 4 deletions test/bucket_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ defmodule KV.BucketTest do
assert KV.Bucket.get(bucket, "milk") == nil

KV.Bucket.put(bucket, "milk", 3)
assert KV.Bucket.get(bucket, "milk") == 3
assert KV.Bucket.get(bucket, "milk") == 4
end

test "are temporary workers" do
assert Supervisor.child_spec(KV.Bucket, []).restart == :temporary
end
end
18 changes: 0 additions & 18 deletions test/registry_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,4 @@ defmodule KV.RegistryTest do
%{registry: registry}
end

test "spawns buckets", %{registry: registry} do
assert KV.Registry.lookup(registry, "shopping") == :error

KV.Registry.create(registry, "shopping")
assert {:ok, bucket} = KV.Registry.lookup(registry, "shopping")

KV.Bucket.put(bucket, "milk", 1)
assert KV.Bucket.get(bucket, "milk") == 1
end

test "removes bucket on crash", %{registry: registry} do
KV.Registry.create(registry, "shopping")
{:ok, bucket} = KV.Registry.lookup(registry, "shopping")

# Stop the bucket with non-normal reason
Agent.stop(bucket, :shutdown)
assert KV.Registry.lookup(registry, "shopping") == :error
end
end