Skip to content

BazaRb::Fake#durable_place silently accepts files over 1024 bytes that the real BazaRb rejects #485

Description

@gemshrine

BazaRb#durable_place (lib/baza-rb.rb) explicitly rejects any file larger than 1024 bytes, raising a RuntimeError that tells the caller to use durable_save() instead. BazaRb::Fake#durable_place (lib/baza-rb/fake.rb), which is meant to be a drop-in test double with the same validation behavior, has no such check and accepts a file of any size.

Steps to reproduce

require "baza-rb/fake"
require "tempfile"

f = Tempfile.new("big")
f.write("x" * 2000)
f.flush

fake = BazaRb::Fake.new
r = fake.durable_place("some-pname", f.path)
puts r

Actual result

Fake#durable_place returns 42 (its fixed fake durable ID) for a 2000-byte file, no error raised.

Expected result

Fake#durable_place should raise the same RuntimeError ("The file is too big ( bytes) for durable_place(), use durable_save() instead") that the real BazaRb#durable_place raises for a file over 1024 bytes, so that a test written against the fake catches the same misuse it would hit against the real client.

Impact

Code and tests that use BazaRb::Fake to simulate durable_place with a file over 1024 bytes will pass locally, then fail at runtime against the real server, because the fake does not enforce the same size limit as BazaRb#durable_place (lib/baza-rb.rb, durable_place method, the "if File.size(file) > 1024" check).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions