From 4e5afd7315877a731179b20a0dc69434e3c3f190 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 10:04:15 -0700 Subject: [PATCH] Re-apply fix for VPC type (#809) (#816) * Fix VPC type * Add a test case * Re-apply link fix and update test * Revert "Re-apply link fix and update test" This reverts commit f2ec20ddee7b4bc24deb570673a031e91ceb63aa. --------- (cherry picked from commit 0e9e8cd2206235052a676148a06b6d58368f5e2e) Signed-off-by: Simeon Widdis Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- .../aws_vpc_flow/aws_vpc_flow-1.0.0.json | 2 +- .../__test__/local_repository.test.ts | 32 ++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/server/adaptors/integrations/__data__/repository/aws_vpc_flow/aws_vpc_flow-1.0.0.json b/server/adaptors/integrations/__data__/repository/aws_vpc_flow/aws_vpc_flow-1.0.0.json index f665c9cc2..86e8a9b03 100644 --- a/server/adaptors/integrations/__data__/repository/aws_vpc_flow/aws_vpc_flow-1.0.0.json +++ b/server/adaptors/integrations/__data__/repository/aws_vpc_flow/aws_vpc_flow-1.0.0.json @@ -4,7 +4,7 @@ "displayName": "AWS VPC Flow", "description": "AWS VPC Flow log collector", "license": "Apache-2.0", - "type": "logs", + "type": "logs_vpc", "author": "Haidong Wang", "sourceUrl": "https://github.com/opensearch-project/dashboards-observability/tree/main/server/adaptors/integrations/__data__/repository/aws_vpc_flow/info", "statics": { diff --git a/server/adaptors/integrations/__test__/local_repository.test.ts b/server/adaptors/integrations/__test__/local_repository.test.ts index bfe3ce583..246aa7e82 100644 --- a/server/adaptors/integrations/__test__/local_repository.test.ts +++ b/server/adaptors/integrations/__test__/local_repository.test.ts @@ -7,16 +7,26 @@ import { Repository } from '../repository/repository'; import { Integration } from '../repository/integration'; import path from 'path'; -describe("The local repository", () => { - it("Should pass shallow validation for all local integrations.", async () => { - let repository: Repository = new Repository(path.join(__dirname, '../__data__/repository')); - let integrations: Integration[] = await repository.getIntegrationList(); - await Promise.all(integrations.map(i => expect(i.check()).resolves.toBeTruthy())); - }); +describe('The local repository', () => { + it('Should pass shallow validation for all local integrations.', async () => { + const repository: Repository = new Repository(path.join(__dirname, '../__data__/repository')); + const integrations: Integration[] = await repository.getIntegrationList(); + await Promise.all(integrations.map((i) => expect(i.check()).resolves.toBeTruthy())); + }); - it("Should pass deep validation for all local integrations.", async () => { - let repository: Repository = new Repository(path.join(__dirname, '../__data__/repository')); - let integrations: Integration[] = await repository.getIntegrationList(); - await Promise.all(integrations.map(i => expect(i.deepCheck()).resolves.toBeTruthy())); - }); + it('Should pass deep validation for all local integrations.', async () => { + const repository: Repository = new Repository(path.join(__dirname, '../__data__/repository')); + const integrations: Integration[] = await repository.getIntegrationList(); + await Promise.all(integrations.map((i) => expect(i.deepCheck()).resolves.toBeTruthy())); + }); + + it('Should not have a type that is not imported in the config', async () => { + const repository: Repository = new Repository(path.join(__dirname, '../__data__/repository')); + const integrations: Integration[] = await repository.getIntegrationList(); + for (const integration of integrations) { + const config = await integration.getConfig(); + const components = config!.components.map((x) => x.name); + expect(components).toContain(config!.type); + } + }); });