From 8d40ab40ce1b16714cfebed9387d5f5e2b764923 Mon Sep 17 00:00:00 2001 From: Claude-GP Date: Mon, 29 Jan 2024 09:27:44 -0500 Subject: [PATCH] fix ci --- .github/workflows/tests.yml | 2 +- lambda/index.ts | 5 +++++ test/mocks/index.ts | 23 ++++++++++++++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8ff171c..0dd6bd4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest env: - TERRAFORM_VERSION: 0.13.5 + TERRAFORM_VERSION: 1.4.0 TERRAFORM_WORK_DIR: ./terraform steps: diff --git a/lambda/index.ts b/lambda/index.ts index 27f322d..9a29686 100755 --- a/lambda/index.ts +++ b/lambda/index.ts @@ -1,6 +1,7 @@ import { Handler } from "aws-lambda"; import axios from 'axios'; import { Payload, Text } from "./types"; +import { error } from "console"; const handler: Handler = async (payload: Payload) => { const apiKey = process.env.API_Key; @@ -8,6 +9,10 @@ const handler: Handler = async (payload: Payload) => { const { headers, data } = payload; try { + if (!apiUrl) + { + throw error; + } // Make the HTTP request using Axios const response = await axios.post(apiUrl, data, { headers: headers, diff --git a/test/mocks/index.ts b/test/mocks/index.ts index 831e602..ee56608 100644 --- a/test/mocks/index.ts +++ b/test/mocks/index.ts @@ -1 +1,22 @@ -import "./libs/aws-sdk"; +export const PAYLOAD = { + headers: [ + + ], + data: { + "message": "An example alert message", + "alias": "Life is too short for no alias", + "description":"Every alert needs a description", + "responders":[ + {"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c", "type":"team"}, + ], + "visibleTo":[ + {"id":"4513b7ea-3b91-438f-b7e4-e3e54af9147c","type":"team"}, + ], + "actions": ["Restart", "AnExampleAction"], + "tags": ["OverwriteQuietHours","Critical"], + "details":{"key1":"value1","key2":"value2"}, + "entity":"An example entity", + "priority":"P1" + } +} +