fix: changes in testcase to accomodate accountName in config provider
Signed-off-by: Nikunj Hudka <nikunjhudka123@gmail.com>
This commit is contained in:
+9
@@ -95,10 +95,19 @@ describe('catalogModuleAzureDevOpsEntityProvider', () => {
|
||||
});
|
||||
|
||||
const config = {
|
||||
integrations: {
|
||||
azureBlobStorage: [
|
||||
{
|
||||
accountName: 'test',
|
||||
accountKey: 'test',
|
||||
},
|
||||
],
|
||||
},
|
||||
catalog: {
|
||||
providers: {
|
||||
azureBlob: {
|
||||
containerName: 'test',
|
||||
accountName: 'test',
|
||||
schedule: {
|
||||
frequency: 'P1M',
|
||||
timeout: 'PT3M',
|
||||
|
||||
+4
-2
@@ -61,7 +61,7 @@ const logger = mockServices.logger.mock();
|
||||
|
||||
describe('AzureBlobStorageEntityProvider', () => {
|
||||
const containerName = 'container-1';
|
||||
|
||||
const accountName = 'myaccount';
|
||||
const expectMutation = async (
|
||||
providerId: string,
|
||||
providerConfig: object,
|
||||
@@ -157,6 +157,7 @@ describe('AzureBlobStorageEntityProvider', () => {
|
||||
'staticContainer',
|
||||
{
|
||||
containerName,
|
||||
accountName,
|
||||
},
|
||||
'https://myaccount.blob.core.windows.net/container-1/',
|
||||
{
|
||||
@@ -171,6 +172,7 @@ describe('AzureBlobStorageEntityProvider', () => {
|
||||
'staticContainerNoPrefix',
|
||||
{
|
||||
containerName,
|
||||
accountName,
|
||||
schedule: {
|
||||
frequency: { minutes: 30 },
|
||||
timeout: { minutes: 3 },
|
||||
@@ -190,9 +192,9 @@ describe('AzureBlobStorageEntityProvider', () => {
|
||||
providers: {
|
||||
azureBlob: {
|
||||
test: {
|
||||
accountName: 'myaccount',
|
||||
containerName: 'container-1',
|
||||
prefix: 'sub/dir/',
|
||||
accountName: 'myaccount',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
+6
-5
@@ -79,11 +79,6 @@ export class AzureBlobStorageEntityProvider implements EntityProvider {
|
||||
azureIntegration =>
|
||||
azureIntegration.config.accountName === providerConfig.accountName,
|
||||
)[0];
|
||||
if (!integration) {
|
||||
throw new Error(
|
||||
`There is no Azure blob storage integration for host. Please add a configuration entry for it under integrations.azure`,
|
||||
);
|
||||
}
|
||||
|
||||
if (!options.schedule && !providerConfig.schedule) {
|
||||
throw new Error(
|
||||
@@ -91,6 +86,12 @@ export class AzureBlobStorageEntityProvider implements EntityProvider {
|
||||
);
|
||||
}
|
||||
|
||||
if (!integration) {
|
||||
throw new Error(
|
||||
`There is no Azure blob storage integration for account. Please add a configuration entry for it under integrations.azureBlobStorage`,
|
||||
);
|
||||
}
|
||||
|
||||
const taskRunner =
|
||||
options.schedule ??
|
||||
options.scheduler!.createScheduledTaskRunner(providerConfig.schedule!);
|
||||
|
||||
@@ -110,6 +110,7 @@ describe('readAzureDevOpsConfigs', () => {
|
||||
describe('readAzureBlobStorageConfigs', () => {
|
||||
it('reads single and multiple Azure Blob Storage provider configs', () => {
|
||||
const provider1 = {
|
||||
accountName: 'account-1',
|
||||
containerName: 'container-1',
|
||||
schedule: {
|
||||
frequency: 'PT30M',
|
||||
@@ -119,6 +120,7 @@ describe('readAzureBlobStorageConfigs', () => {
|
||||
},
|
||||
};
|
||||
const provider2 = {
|
||||
accountName: 'account-1',
|
||||
containerName: 'container-2',
|
||||
};
|
||||
|
||||
@@ -148,6 +150,7 @@ describe('readAzureBlobStorageConfigs', () => {
|
||||
expect(actualSingle).toHaveLength(1);
|
||||
expect(actualSingle[0]).toEqual({
|
||||
id: 'default',
|
||||
accountName: 'account-1',
|
||||
containerName: 'container-2',
|
||||
schedule: undefined, // no schedule provided in this case
|
||||
});
|
||||
@@ -159,6 +162,7 @@ describe('readAzureBlobStorageConfigs', () => {
|
||||
expect(actualMulti).toHaveLength(2);
|
||||
expect(actualMulti[0]).toEqual({
|
||||
id: 'provider1',
|
||||
accountName: 'account-1',
|
||||
containerName: 'container-1',
|
||||
schedule: {
|
||||
...provider1.schedule,
|
||||
@@ -167,6 +171,7 @@ describe('readAzureBlobStorageConfigs', () => {
|
||||
});
|
||||
expect(actualMulti[1]).toEqual({
|
||||
id: 'provider2',
|
||||
accountName: 'account-1',
|
||||
containerName: 'container-2',
|
||||
schedule: undefined, // no schedule provided
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user