Sha256: 57ab7c54db1eda8f86a648147de8bfb37eabb60f858ef7d53aca6a025c15adea

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 KB

Contents

describe "Local File Store" do
  it_should_behave_like "AppSwarm Test"
  it "should store data permanently" do
    b=TestBed.new
    lfs=b.run("LocalFileStore")
    lfsapi=lfs.api("myApp","myInstance")
    lfsapi.rm("testFile")
    lfsapi["testFile"]="testContent"
    b.stop!
    checkThreads("inBetween")

    b=TestBed.new(:testbedId=>b.testbedId)
    lfs=b.run("LocalFileStore")
    lfsapi=lfs.api("myApp","myInstance")
    lfsapi["testFile"].should == "testContent"
    lfsapi.rm("testFile")
    b.stop!
    sleep 2
  end
  it "should cache data before writing" do
    b=TestBed.new
    lfs=b.run("LocalFileStore")
    lfsapi=lfs.cached("myApp","myInstance")
    lfsapi.rm("testFile")
    lfsapi["testFile"]="testContent"
    lfs.api("myApp","myInstance")["testFile"].should be_nil
    lfsapi["testFile"].should == "testContent"
    b.stop!
    checkThreads("inBetween")
    b=TestBed.new(:testbedId=>b.testbedId)
    lfs=b.run("LocalFileStore")
    lfsapi=lfs.api("myApp","myInstance")
    lfsapi["testFile"].should == "testContent"
    b.stop
    sleep 2
  end
  
  it "should cache data in read cache" do
    b=TestBed.new
    lfs=b.run("LocalFileStore")
    lfsapi=lfs.cached("myApp","myInstance")
    lfsapi.rm("testFile")
    lfsapi["testFile"]="testContent"
    lfs.api("myApp","myInstance")["testFile"].should be_nil
    lfsapi.flush
    lfs.api("myApp","myInstance")["testFile"].should == "testContent"
    lfs.api("myApp","myInstance").rm("testFile")
    lfs.api("myApp","myInstance")["testFile"].should be_nil
    lfsapi["testFile"].should == "testContent" # still there
    b.stop
  end
  

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appswarm-0.0.1 apps/local_file_store/spec/local_file_store_spec.rb