Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
NO-JIRA: Add cloud providers info to mocked bridges responses (#186)
Browse files Browse the repository at this point in the history
* add providers to bridges mocked apis
add missing owner to new mocked bridges

* fix tests
  • Loading branch information
kelvah authored Sep 21, 2022
1 parent 96aad8e commit 894552a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cypress/integration/InstancesTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ describe("Instances Test", () => {
)
.should("be.visible");
cy.ouiaId("instance-details-owner")
.should("have.text", "bebianco@redhat.com")
.should("have.text", "bebianco")
.should("be.visible");
cy.ouiaId("instance-details-submitted-date")
.should("have.text", formatDate("2022-02-24T13:34:00Z"))
Expand Down
48 changes: 36 additions & 12 deletions mocked-api/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ export const instancesData = [
id: "3543edaa-1851-4ad7-96be-ebde7d20d717",
name: "Instance one",
href: "/api/smartevents_mgmt/v1/bridges/3543edaa-1851-4ad7-96be-ebde7d20d717",
owner: "bebianco@redhat.com",
owner: "bebianco",
status: "ready",
submitted_at: "2022-02-24T13:34:00Z",
published_at: "2022-02-24T13:35:00Z",
endpoint:
"https://3543edaa-1851-4ad7-96be-ebde7d20d717.apps.openbridge-dev.fdvn.p1.openshiftapps.com/events",
cloud_provider: "aws",
region: "us-east-1",
error_handler: {
type: "webhook_sink_0.1",
parameters: `{"endpoint":"http://google.com","basic_auth_password":"my-password","basic_auth_username":"user","ssl_verification_disabled":false}`,
Expand All @@ -20,12 +22,14 @@ export const instancesData = [
id: "830c8f0d-c677-492f-8d7e-0f81893fbba6",
name: "Instance two",
href: "/api/smartevents_mgmt/v1/bridges/830c8f0d-c677-492f-8d7e-0f81893fbba6",
owner: "bebianco@redhat.com",
owner: "bebianco",
status: "ready",
submitted_at: "2022-02-20T11:23:00Z",
published_at: "2022-02-20T11:24:00Z",
endpoint:
"https://830c8f0d-c677-492f-8d7e-0f81893fbba6.apps.openbridge-dev.fdvn.p1.openshiftapps.com/events",
cloud_provider: "aws",
region: "us-east-1",
error_handler: {
type: "kafka_topic_sink_0.1",
parameters: `{"topic":"my-topic","kafka_client_id":"my-client","kafka_broker_url":"username-c--hj---mhlksdfss-p--a.bf2.kafka.rhcloud.com:443","kafka_client_secret":"my-secret"}`,
Expand All @@ -36,116 +40,136 @@ export const instancesData = [
id: "ee22ce62-1f23-4dd7-b106-e4158baf8228",
name: "Instance three",
href: "/api/smartevents_mgmt/v1/bridges/ee22ce62-1f23-4dd7-b106-e4158baf8228",
owner: "bebianco@redhat.com",
owner: "bebianco",
status: "accepted",
submitted_at: "2022-02-15T12:03:00Z",
published_at: "2022-02-15T12:04:00Z",
cloud_provider: "aws",
region: "us-east-1",
},
{
kind: "Bridge",
id: "21ac90ba-76d2-4f88-b08b-2547ef359bae",
name: "Instance four",
href: "/api/smartevents_mgmt/v1/bridges/21ac90ba-76d2-4f88-b08b-2547ef359bae",
owner: "bebianco@redhat.com",
owner: "bebianco",
status: "provisioning",
submitted_at: "2022-02-10T16:34:00Z",
published_at: "2022-02-10T16:35:00Z",
cloud_provider: "aws",
region: "us-east-1",
},
{
kind: "Bridge",
id: "d4de4dd9-42fe-48ec-8ac7-42163e6e971a",
name: "error-test",
href: "/api/smartevents_mgmt/v1/bridges/d4de4dd9-42fe-48ec-8ac7-42163e6e971a",
owner: "bebianco@redhat.com",
owner: "bebianco",
status: "ready",
submitted_at: "2022-02-05T13:58:00Z",
published_at: "2022-02-05T13:59:00Z",
endpoint:
"https://d4de4dd9-42fe-48ec-8ac7-42163e6e971a.apps.openbridge-dev.fdvn.p1.openshiftapps.com/events",
cloud_provider: "aws",
region: "us-east-1",
},
{
kind: "Bridge",
id: "d7e13602-b046-4120-b377-15d61e21c31a",
name: "Instance six",
href: "/api/smartevents_mgmt/v1/bridges/d7e13602-b046-4120-b377-15d61e21c31a",
owner: "bebianco@redhat.com",
owner: "bebianco",
status: "ready",
submitted_at: "2022-02-01T12:02:00Z",
published_at: "2022-02-01T12:03:00Z",
endpoint:
"https://d7e13602-b046-4120-b377-15d61e21c31a.apps.openbridge-dev.fdvn.p1.openshiftapps.com/events",
cloud_provider: "aws",
region: "us-east-1",
},
{
kind: "Bridge",
id: "3a7efbed-3562-4a95-9c32-f49d12d8cab2",
name: "Instance seven",
href: "/api/smartevents_mgmt/v1/bridges/3a7efbed-3562-4a95-9c32-f49d12d8cab2",
owner: "bebianco@redhat.com",
owner: "bebianco",
status: "ready",
submitted_at: "2021-12-25T21:46:00Z",
published_at: "2021-12-25T21:47:00Z",
endpoint:
"https://3a7efbed-3562-4a95-9c32-f49d12d8cab2.apps.openbridge-dev.fdvn.p1.openshiftapps.com/events",
cloud_provider: "aws",
region: "us-east-1",
},
{
kind: "Bridge",
id: "fa648473-3662-4bbc-99ba-158d9ab95ccc",
name: "Instance eight",
owner: "bebianco@redhat.com",
owner: "bebianco",
href: "/api/smartevents_mgmt/v1/bridges/fa648473-3662-4bbc-99ba-158d9ab95ccc",
status: "ready",
submitted_at: "2021-12-20T12:21:00Z",
published_at: "2021-12-20T12:22:00Z",
endpoint:
"https://fa648473-3662-4bbc-99ba-158d9ab95ccc.apps.openbridge-dev.fdvn.p1.openshiftapps.com/events",
cloud_provider: "aws",
region: "us-east-1",
},
{
kind: "Bridge",
id: "04f131c3-b34c-4ee2-b153-fbff0bb91ece",
name: "Instance nine",
owner: "bebianco@redhat.com",
owner: "bebianco",
href: "/api/smartevents_mgmt/v1/bridges/04f131c3-b34c-4ee2-b153-fbff0bb91ece",
status: "ready",
submitted_at: "2021-12-15T16:09:00Z",
published_at: "2021-12-15T16:10:00Z",
endpoint:
"https://04f131c3-b34c-4ee2-b153-fbff0bb91ece.apps.openbridge-dev.fdvn.p1.openshiftapps.com/events",
cloud_provider: "aws",
region: "us-east-1",
},
{
kind: "Bridge",
id: "c28da8c0-05e4-42f3-a3fd-615cc7fbb382",
name: "Instance ten",
owner: "bebianco@redhat.com",
owner: "bebianco",
href: "/api/smartevents_mgmt/v1/bridges/c28da8c0-05e4-42f3-a3fd-615cc7fbb382",
status: "ready",
submitted_at: "2021-12-10T11:34:00Z",
published_at: "2021-12-10T11:35:00Z",
endpoint:
"https://c28da8c0-05e4-42f3-a3fd-615cc7fbb382.apps.openbridge-dev.fdvn.p1.openshiftapps.com/events",
cloud_provider: "aws",
region: "us-east-1",
},
{
kind: "Bridge",
id: "a8c1cb57-0ab3-4ccb-8c55-ef8a8b166846",
name: "Instance eleven",
owner: "bebianco@redhat.com",
owner: "bebianco",
href: "/api/smartevents_mgmt/v1/bridges/a8c1cb57-0ab3-4ccb-8c55-ef8a8b166846",
status: "ready",
submitted_at: "2021-12-05T11:34:00Z",
published_at: "2021-12-05T11:35:00Z",
endpoint:
"https://a8c1cb57-0ab3-4ccb-8c55-ef8a8b166846.apps.openbridge-dev.fdvn.p1.openshiftapps.com/events",
cloud_provider: "aws",
region: "us-east-1",
},
{
kind: "Bridge",
id: "e176d63b-6fdc-43ce-afc8-45160f456502",
name: "Instance twelve",
owner: "bebianco@redhat.com",
owner: "bebianco",
href: "/api/smartevents_mgmt/v1/bridges/e176d63b-6fdc-43ce-afc8-45160f456502",
status: "ready",
submitted_at: "2021-12-01T11:34:00Z",
published_at: "2021-12-01T11:35:00Z",
endpoint:
"https://e176d63b-6fdc-43ce-afc8-45160f456502.apps.openbridge-dev.fdvn.p1.openshiftapps.com/events",
cloud_provider: "aws",
region: "us-east-1",
},
];

Expand Down
12 changes: 11 additions & 1 deletion mocked-api/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const db = factory({
type: String,
parameters: String,
},
cloud_provider: String,
region: String,
},
processor: {
id: primaryKey(String),
Expand Down Expand Up @@ -178,7 +180,12 @@ export const handlers = [
// create a bridge
rest.post(`${apiUrl}/bridges`, async (req, res, ctx) => {
const bridgeRequest: BridgeRequest = await req.json();
const { name, error_handler: errorHandler } = bridgeRequest;
const {
name,
error_handler: errorHandler,
cloud_provider,
region,
} = bridgeRequest;

const existingBridge = db.bridge.findFirst({
where: {
Expand Down Expand Up @@ -223,10 +230,13 @@ export const handlers = [
kind: "Bridge",
id,
name,
owner: "rsanchez",
href: `/api/smartevents_mgmt/v1/bridges/${id}`,
submitted_at: new Date().toISOString(),
error_handler: convertParametersToString(errorHandler),
status: "accepted",
cloud_provider,
region,
};

const newBridge = db.bridge.create(bridge);
Expand Down
6 changes: 3 additions & 3 deletions src/app/Processor/ProcessorEdit/ProcessorEdit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ describe("ProcessorEdit component", () => {
"/api/smartevents_mgmt/v1/bridges/d7e13602-b046-4120-b377-15d61e21c31a";
const submitted_at = "2022-02-01T12:02:00Z";
const published_at = "2022-02-01T12:03:00Z";
const owner = "bebianco@redhat.com";
const owner = "bebianco";
const status = "ready";
const { comp } = setupProcessorEdit({
saveButtonLabel: "Save",
Expand Down Expand Up @@ -578,7 +578,7 @@ describe("ProcessorEdit component", () => {
type: ProcessorType.Sink,
kind: "Bridge",
href: "/api/smartevents_mgmt/v1/bridges/f8f34af4-caed-11ec-9d64-0242ac120002",
owner: "bebianco@redhat.com",
owner: "bebianco",
},
});
await waitForI18n(comp);
Expand All @@ -600,7 +600,7 @@ const baseProcessor = {
status: ManagedResourceStatus.Ready,
kind: "Bridge",
href: "/api/smartevents_mgmt/v1/bridges/f8f34af4-caed-11ec-9d64-0242ac120002",
owner: "bebianco@redhat.com",
owner: "bebianco",
};

const sourceProcessor = {
Expand Down

0 comments on commit 894552a

Please sign in to comment.