public async Task AlwaysOverridesMetadata() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["metadata1"] = "somemetadata"; var success1 = await TryOptimisticWrite(_location, m, data).ConfigureAwait(false); var oldMetadata = await _store.GetMetadata(_location).ConfigureAwait(false); var m2 = new Metadata(); m2.ETag = oldMetadata.ETag; m2["metadata2"] = "othermetadata"; var success2 = await TryOptimisticWrite(_location, m2, data).ConfigureAwait(false); var newMetadata = await _store.GetMetadata(_location).ConfigureAwait(false); await _blob.FetchAttributesAsync().ConfigureAwait(false); Assert.IsTrue(success1.Result, "first write failed"); Assert.IsTrue(success2.Result, "second write failed"); Assert.AreEqual(success1.Metadata.Snapshot, oldMetadata.Snapshot); Assert.AreEqual(success2.Metadata.Snapshot, newMetadata.Snapshot); Assert.AreNotEqual(success1.Metadata.Snapshot, success2.Metadata.Snapshot); Assert.IsFalse(_blob.Metadata.ContainsKey("metadata1")); Assert.AreEqual("othermetadata", _blob.Metadata["metadata2"]); }
public virtual void Init() { _store = new AzureStore(AzureTestsHelper.GetDevelopentService(), true); _blob = AzureTestsHelper.GetBlockBlob("kalix-leo-tests", "AzureStoreTests.testdata", true); _location = new StoreLocation("kalix-leo-tests", "AzureStoreTests.testdata"); }
public void AlwaysOverridesMetadata() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["metadata1"] = "somemetadata"; var success1 = TryOptimisticWrite(_location, m, data); var oldMetadata = _store.GetMetadata(_location).Result; var m2 = new Metadata(); m2.ETag = oldMetadata.ETag; m2["metadata2"] = "othermetadata"; var success2 = TryOptimisticWrite(_location, m2, data); var newMetadata = _store.GetMetadata(_location).Result; var props = _blob.GetProperties().Value; Assert.IsTrue(success1.Result, "first write failed"); Assert.IsTrue(success2.Result, "second write failed"); Assert.AreEqual(success1.Metadata.Snapshot, oldMetadata.Snapshot); Assert.AreEqual(success2.Metadata.Snapshot, newMetadata.Snapshot); Assert.AreNotEqual(success1.Metadata.Snapshot, success2.Metadata.Snapshot); Assert.IsFalse(props.Metadata.ContainsKey("metadata1")); Assert.AreEqual("B64_b3RoZXJtZXRhZGF0YQ==", props.Metadata["metadata2"]); }
public async Task MultiUploadLargeFileIsSuccessful() { var data = AzureTestsHelper.RandomData(7); await WriteData(_location, null, data).ConfigureAwait(false); Assert.IsTrue(await _blob.ExistsAsync().ConfigureAwait(false)); }
public void MultiUploadLargeFileIsSuccessful() { var data = AzureTestsHelper.RandomData(7); WriteData(_location, null, data); Assert.IsTrue(_blob.Exists()); }
public void NoETagMustBeNewSave() { var data = AzureTestsHelper.RandomData(1); var success1 = TryOptimisticWrite(_location, null, data); var success2 = TryOptimisticWrite(_location, null, data); Assert.IsTrue(success1.Result, "first write failed"); Assert.IsFalse(success2.Result, "second write succeeded"); }
public void MultiUploadLargeFileIsSuccessful() { var data = AzureTestsHelper.RandomData(7); var success = TryOptimisticWrite(_location, null, data); Assert.IsTrue(success.Result); Assert.IsNotNull(success.Metadata.Snapshot); Assert.IsTrue(_blob.Exists()); }
public async Task MultiUploadLargeFileIsSuccessful() { var data = AzureTestsHelper.RandomData(7); var success = await TryOptimisticWrite(_location, null, data).ConfigureAwait(false); Assert.IsTrue(success.Result); Assert.IsNotNull(success.Metadata.Snapshot); Assert.IsTrue(await _blob.ExistsAsync().ConfigureAwait(false)); }
public async Task NoETagMustBeNewSave() { var data = AzureTestsHelper.RandomData(1); var success1 = await TryOptimisticWrite(_location, null, data).ConfigureAwait(false); var success2 = await TryOptimisticWrite(_location, null, data).ConfigureAwait(false); Assert.IsTrue(success1.Result, "first write failed"); Assert.IsFalse(success2.Result, "second write succeeded"); }
public async Task WritesStoreVersion() { var data = AzureTestsHelper.RandomData(1); await WriteData(_location, null, data).ConfigureAwait(false); await _blob.FetchAttributesAsync().ConfigureAwait(false); Assert.AreEqual("2.0", _blob.Metadata["leoazureversion"]); }
public void ETagDoesNotMatchFails() { var data = AzureTestsHelper.RandomData(1); var metadata = new Metadata { ETag = "notreal" }; var success = TryOptimisticWrite(_location, metadata, data); Assert.IsFalse(success.Result, "write should not have succeeded with fake eTag"); }
public async Task DoesNotReturnInternalVersion() { var data = AzureTestsHelper.RandomData(1); await WriteData(_location, null, data).ConfigureAwait(false); var result = await _store.LoadData(_location).ConfigureAwait(false); Assert.IsFalse(result.Metadata.ContainsKey("leoazureversion")); }
public async Task ETagDoesNotMatchFails() { var data = AzureTestsHelper.RandomData(1); var metadata = new Metadata { ETag = "\"0x8D49E94826A33D9\"" }; var success = await TryOptimisticWrite(_location, metadata, data).ConfigureAwait(false); Assert.IsFalse(success.Result, "write should not have succeeded with fake eTag"); }
public void WritesStoreVersion() { var data = AzureTestsHelper.RandomData(1); WriteData(_location, null, data); var props = _blob.GetProperties().Value; Assert.AreEqual("2.0", props.Metadata["leoazureversion"]); }
public void DoesNotReturnInternalVersion() { var data = AzureTestsHelper.RandomData(1); WriteData(_location, null, data); var result = _store.LoadData(_location).Result; Assert.IsFalse(result.Metadata.ContainsKey("leoazureversion")); }
public void IfFileLockedReturnsFalse() { Assert.ThrowsAsync <LockException>(async() => { using (var l = await _store.Lock(_location).ConfigureAwait(false)) { var data = AzureTestsHelper.RandomData(1); await WriteData(_location, null, data).ConfigureAwait(false); } }); }
public void HasMetadataCorrectlySavesIt() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["metadata1"] = "somemetadata"; WriteData(_location, m, data); var props = _blob.GetProperties().Value; Assert.AreEqual("B64_c29tZW1ldGFkYXRh", props.Metadata["metadata1"]); }
public void SingleSnapshotCanBeFound() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["metadata1"] = "metadata"; WriteData(_location, m, data); var snapshots = _store.FindSnapshots(_location).ToEnumerable(); Assert.AreEqual(1, snapshots.Count()); }
public void FileMarkedAsDeletedReturnsNull() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["leodeleted"] = DateTime.UtcNow.Ticks.ToString(); WriteData(_location, m, data); var result = _store.LoadData(_location).Result; Assert.IsNull(result); }
public async Task HasMetadataCorrectlySavesIt() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["metadata1"] = "somemetadata"; await WriteData(_location, m, data).ConfigureAwait(false); await _blob.FetchAttributesAsync().ConfigureAwait(false); Assert.AreEqual("somemetadata", _blob.Metadata["metadata1"]); }
public async Task SingleSnapshotCanBeFound() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["metadata1"] = "metadata"; await WriteData(_location, m, data).ConfigureAwait(false); var snapshots = await _store.FindSnapshots(_location).ToList().ConfigureAwait(false); Assert.AreEqual(1, snapshots.Count()); }
public async Task BlobThatIsSoftDeletedShouldNotBeLoadable() { var data = AzureTestsHelper.RandomData(1); await WriteData(_location, null, data).ConfigureAwait(false); await _store.PermanentDelete(_location).ConfigureAwait(false); var result = await _store.LoadData(_location).ConfigureAwait(false); Assert.IsNull(result); }
public async Task FileMarkedAsDeletedReturnsNull() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["leodeleted"] = DateTime.UtcNow.Ticks.ToString(); await WriteData(_location, m, data).ConfigureAwait(false); var result = await _store.LoadData(_location).ConfigureAwait(false); Assert.IsNull(result); }
public void BlobThatIsSoftDeletedShouldNotBeLoadable() { var data = AzureTestsHelper.RandomData(1); WriteData(_location, null, data); _store.PermanentDelete(_location).Wait(); var result = _store.LoadData(_location).Result; Assert.IsNull(result); }
public void MetadataIsTransferedWhenSelectingAStream() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["metadata1"] = "metadata"; var shapshot = WriteData(_location, m, data); var res = _store.LoadData(_location, shapshot).Result; Assert.AreEqual(shapshot, res.Metadata.Snapshot); Assert.AreEqual("metadata", res.Metadata["metadata1"]); }
public void ShouldDeleteAllSnapshots() { var data = AzureTestsHelper.RandomData(1); WriteData(_location, null, data); var shapshot = _store.FindSnapshots(_location).ToEnumerable().Single().Id; _store.PermanentDelete(_location).Wait(); var result = _store.LoadData(_location, shapshot).Result; Assert.IsNull(result); }
public async Task MetadataIsTransferedWhenSelectingAStream() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["metadata1"] = "metadata"; var shapshot = await WriteData(_location, m, data).ConfigureAwait(false); var res = await _store.LoadData(_location, shapshot).ConfigureAwait(false); Assert.AreEqual(shapshot, res.Metadata.Snapshot); Assert.AreEqual("metadata", res.Metadata["metadata1"]); }
public async Task ShouldDeleteAllSnapshots() { var data = AzureTestsHelper.RandomData(1); await WriteData(_location, null, data).ConfigureAwait(false); var shapshot = (await _store.FindSnapshots(_location).ToList().ConfigureAwait(false)).Single().Id; await _store.PermanentDelete(_location).ConfigureAwait(false); var result = await _store.LoadData(_location, shapshot).ConfigureAwait(false); Assert.IsNull(result); }
public void HasMetadataCorrectlySavesIt() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["metadata1"] = "somemetadata"; var success = TryOptimisticWrite(_location, m, data); var props = _blob.GetProperties().Value; Assert.IsTrue(success.Result); Assert.IsNotNull(success.Metadata.Snapshot); Assert.AreEqual("B64_c29tZW1ldGFkYXRh", props.Metadata["metadata1"]); }
public async Task HasMetadataCorrectlySavesIt() { var data = AzureTestsHelper.RandomData(1); var m = new Metadata(); m["metadata1"] = "somemetadata"; var success = await TryOptimisticWrite(_location, m, data).ConfigureAwait(false); await _blob.FetchAttributesAsync().ConfigureAwait(false); Assert.IsTrue(success.Result); Assert.IsNotNull(success.Metadata.Snapshot); Assert.AreEqual("somemetadata", _blob.Metadata["metadata1"]); }