chore: remove used code and solve eslint error
Signed-off-by: NIKUNJ LALITKUMAR HUDKA <nk856850@dal.ca>
This commit is contained in:
+3
-15
@@ -39,10 +39,7 @@ import {
|
||||
UrlReaderServiceSearchResponse,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
|
||||
export function parseUrl(
|
||||
url: string,
|
||||
config: AzureBlobStorageIntergation,
|
||||
): { path: string; container: string } {
|
||||
export function parseUrl(url: string): { path: string; container: string } {
|
||||
const parsedUrl = new URL(url);
|
||||
const pathSegments = parsedUrl.pathname.split('/').filter(Boolean);
|
||||
|
||||
@@ -138,7 +135,7 @@ export class AzureBlobStorageUrlReader implements UrlReaderService {
|
||||
const { etag, lastModifiedAfter } = options ?? {};
|
||||
|
||||
try {
|
||||
const { path, container } = parseUrl(url, this.integration);
|
||||
const { path, container } = parseUrl(url);
|
||||
|
||||
const containerClient = await this.createContainerClient(container);
|
||||
const blobClient = containerClient.getBlobClient(path);
|
||||
@@ -184,7 +181,7 @@ export class AzureBlobStorageUrlReader implements UrlReaderService {
|
||||
options?: UrlReaderServiceReadTreeOptions,
|
||||
): Promise<UrlReaderServiceReadTreeResponse> {
|
||||
try {
|
||||
const { path, container } = parseUrl(url, this.integration);
|
||||
const { path, container } = parseUrl(url);
|
||||
|
||||
const containerClient = await this.createContainerClient(container);
|
||||
|
||||
@@ -230,15 +227,6 @@ export class AzureBlobStorageUrlReader implements UrlReaderService {
|
||||
)}}`;
|
||||
}
|
||||
|
||||
private parseUrl(url: string): { path: string } {
|
||||
const parsedUrl = new URL(url);
|
||||
const path = parsedUrl.pathname.substring(
|
||||
parsedUrl.pathname.lastIndexOf('/') + 1,
|
||||
);
|
||||
|
||||
return { path };
|
||||
}
|
||||
|
||||
private async retrieveAzureBlobData(stream: Readable): Promise<Readable> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
|
||||
@@ -18,9 +18,7 @@ import {
|
||||
AccessToken,
|
||||
ClientSecretCredential,
|
||||
DefaultAzureCredential,
|
||||
TokenCredential,
|
||||
} from '@azure/identity';
|
||||
import { AzureBlobStorageIntegrationConfig } from './config';
|
||||
import { ScmIntegrationRegistry } from '../registry';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { DefaultAzureCredentialsManager } from './DefaultAzureCredentialsProvider';
|
||||
|
||||
+3
-13
@@ -48,6 +48,7 @@ jest.mock('@azure/storage-blob', () => {
|
||||
BlobServiceClient: jest.fn().mockImplementation(() => ({
|
||||
url: 'https://myaccount.blob.core.windows.net/',
|
||||
getContainerClient: jest.fn().mockImplementation(() => ({
|
||||
// eslint-disable-next-line func-names
|
||||
listBlobsFlat: jest.fn(async function* () {
|
||||
yield* createBlobList(blobs);
|
||||
}),
|
||||
@@ -65,7 +66,6 @@ describe('AzureBlobStorageEntityProvider', () => {
|
||||
providerId: string,
|
||||
providerConfig: object,
|
||||
expectedBaseUrl: string,
|
||||
names: Record<string, string>,
|
||||
integrationConfig?: object,
|
||||
scheduleInConfig?: boolean,
|
||||
) => {
|
||||
@@ -151,6 +151,7 @@ describe('AzureBlobStorageEntityProvider', () => {
|
||||
});
|
||||
};
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('apply full update on scheduled execution', async () => {
|
||||
return expectMutation(
|
||||
'staticContainer',
|
||||
@@ -158,18 +159,13 @@ describe('AzureBlobStorageEntityProvider', () => {
|
||||
containerName,
|
||||
},
|
||||
'https://myaccount.blob.core.windows.net/container-1/',
|
||||
{
|
||||
'key1.yaml': 'generated-8ece85ad90200c6577b99f553dcbedde05fa34bb',
|
||||
'key2.yaml': 'generated-6b54c6aaa44696f5e91ce0f54fb27bf837549d11',
|
||||
'key3.yaml': 'generated-88c703cf1aa66913db4033b029adc0b174574646',
|
||||
'key4.yaml': 'generated-2b7e068bb4ec818c14f179a1e721843fc2dbc5f9',
|
||||
},
|
||||
{
|
||||
accountName: 'myaccount',
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('apply full update no prefix', async () => {
|
||||
return expectMutation(
|
||||
'staticContainerNoPrefix',
|
||||
@@ -181,12 +177,6 @@ describe('AzureBlobStorageEntityProvider', () => {
|
||||
},
|
||||
},
|
||||
'https://myaccount.blob.core.windows.net/container-1/',
|
||||
{
|
||||
'key1.yaml': 'generated-8ece85ad90200c6577b99f553dcbedde05fa34bb',
|
||||
'key2.yaml': 'generated-6b54c6aaa44696f5e91ce0f54fb27bf837549d11',
|
||||
'key3.yaml': 'generated-88c703cf1aa66913db4033b029adc0b174574646',
|
||||
'key4.yaml': 'generated-2b7e068bb4ec818c14f179a1e721843fc2dbc5f9',
|
||||
},
|
||||
{
|
||||
host: 'blob.core.windows.net',
|
||||
accountName: 'myaccount',
|
||||
|
||||
Reference in New Issue
Block a user