Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
RohitRanjanMS committed Feb 21, 2025
1 parent a3537f1 commit 4377023
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ protected async Task CosmosDBTriggerToBlobTest()
// Waiting for the Processor to acquire leases
await Task.Delay(10000);

//await Fixture.InitializeDocumentClient();
Fixture.InitializeCosmosClient();

bool collectionsCreated = await Fixture.CreateDocumentCollections();

var resultBlob = Fixture.TestOutputContainer.GetBlockBlobReference("cosmosdbtriggere2e-completed");
await resultBlob.DeleteIfExistsAsync();

Expand All @@ -51,7 +49,7 @@ protected async Task CosmosDBTriggerToBlobTest()
await Fixture.DeleteDocumentCollections();
}

Assert.False(string.IsNullOrEmpty(result));
Assert.False(string.IsNullOrEmpty(result));
}

protected async Task CosmosDBTest()
Expand Down Expand Up @@ -111,7 +109,7 @@ public override void ConfigureScriptHost(IWebJobsBuilder webJobsBuilder)
"CosmosDBOut"
};
});
}
}

public void InitializeCosmosClient()
{
Expand All @@ -121,19 +119,19 @@ public void InitializeCosmosClient()
CosmosClient = new CosmosClient(connectionString);
}
}

public async Task<bool> CreateDocumentCollections()
{
bool willCreateCollection = false;
Database database = await CosmosClient.CreateDatabaseIfNotExistsAsync("ItemDb");

ContainerProperties itemCollectionProperties = new ContainerProperties("ItemCollection", "/_partitionKey");
ContainerProperties itemCollectionProperties = new ContainerProperties("ItemCollection", "/id");
ContainerResponse itemCollectionResponse = await database.CreateContainerIfNotExistsAsync(
itemCollectionProperties,
throughput: 400);
willCreateCollection = itemCollectionResponse.StatusCode == System.Net.HttpStatusCode.Created;

ContainerProperties leasesCollectionProperties = new ContainerProperties("leases", "/_partitionKey");
ContainerProperties leasesCollectionProperties = new ContainerProperties("leases", "/id");
await database.CreateContainerIfNotExistsAsync(
leasesCollectionProperties,
throughput: 400);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public Task CosmosDBTrigger()
return CosmosDBTriggerToBlobTest();
}

//[Fact]
//public Task CosmosDB()
//{
// return CosmosDBTest();
//}
[Fact]
public Task CosmosDB()
{
return CosmosDBTest();
}

public class TestFixture : CosmosDBTestFixture
{
Expand Down

0 comments on commit 4377023

Please sign in to comment.