Repository: hyperjumptech/monika
Pull request #879 (2022-09-08 06:55:53)

Chore/875 reduce complexity
# Monika Pull Request (PR)  

## What feature/issue does this PR add  
1. Closing #875

## How did you implement / how did you fix it  
1. Reduce complexity to doProbe(), remove eslint wrning
2. Add generic response processing()

## How to test  
1. use the following `config.yaml`:
```yaml
probes:
  - id: check-tcp
    name: localhost all works
    alerts:
      - query: response.status == 500
        message: tcp not accessible
    incidentThreshold: 2
    recoveryThreshold: 2

    socket:
      host: localhost
      port: 3333
      data: hello

  - id: checking-redis
    name: localhost all works
    alerts:
      - query: response.status != 200
        message: redis not available
    incidentThreshold: 2
    recoveryThreshold: 2
    redis:
      - host: 172.17.0.1
        port: 6379

  - id: http-probe-01
    name: 'test status 400'
    interval: 5
    requests:
      - url: http://httpbin.org/status/400
        method: GET
        timeout: 5000
        saveBody: false
        headers:
          Content-Type: application/json; charset=utf-8
    alerts:
      - query: response.status != 400
        message: Http Response status code is not 200!
      - query: response.time > 10000
        message: Yo too slow!
    incidentThreshold: 2
    recoveryThreshold: 2

notifications:
  - id: desktop-01
    type: desktop
```
2. Run `bin/run -c config.yaml`
3. Remove tcp/redis availability to see alerts/notifications
4. Probes should run with proper logs and alerts

# Screenshot
Monika running logs with some events
![image](https://user-images.githubusercontent.com/964106/189061681-b2b423f0-71a6-4723-bef4-c75ace9d3e6c.png)



codecov[bot]: # [Codecov](https://codecov.io/gh/hyperjumptech/monika/pull/879?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech) Report
> Merging [#879](https://codecov.io/gh/hyperjumptech/monika/pull/879?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech) (13eac77) into [main](https://codecov.io/gh/hyperjumptech/monika/commit/0a3ca6d88f981a4aa46bdd339009ce34c2295b00?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech) (0a3ca6d) will **decrease** coverage by `0.77%`.
> The diff coverage is `18.39%`.

```diff
@@            Coverage Diff             @@
##             main     #879      +/-   ##
==========================================
- Coverage   49.06%   48.29%   -0.78%     
==========================================
  Files          71       72       +1     
  Lines        2411     2464      +53     
  Branches      483      491       +8     
==========================================
+ Hits         1183     1190       +7     
- Misses       1048     1092      +44     
- Partials      180      182       +2     
```


| [Impacted Files](https://codecov.io/gh/hyperjumptech/monika/pull/879?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech) | Coverage Δ | |
|---|---|---|
| [src/components/config/create-config.ts](https://codecov.io/gh/hyperjumptech/monika/pull/879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech#diff-c3JjL2NvbXBvbmVudHMvY29uZmlnL2NyZWF0ZS1jb25maWcudHM=) | `35.71% <ø> (ø)` | |
| [src/components/config/parse-sitemap.ts](https://codecov.io/gh/hyperjumptech/monika/pull/879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech#diff-c3JjL2NvbXBvbmVudHMvY29uZmlnL3BhcnNlLXNpdGVtYXAudHM=) | `70.00% <ø> (ø)` | |
| [src/components/config/parse.ts](https://codecov.io/gh/hyperjumptech/monika/pull/879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech#diff-c3JjL2NvbXBvbmVudHMvY29uZmlnL3BhcnNlLnRz) | `52.50% <ø> (ø)` | |
| [src/components/notification/index.ts](https://codecov.io/gh/hyperjumptech/monika/pull/879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech#diff-c3JjL2NvbXBvbmVudHMvbm90aWZpY2F0aW9uL2luZGV4LnRz) | `69.00% <ø> (ø)` | |
| [src/components/probe/index.ts](https://codecov.io/gh/hyperjumptech/monika/pull/879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech#diff-c3JjL2NvbXBvbmVudHMvcHJvYmUvaW5kZXgudHM=) | `12.61% <6.25%> (-1.22%)` | :arrow_down: |
| [src/components/redis-request/index.ts](https://codecov.io/gh/hyperjumptech/monika/pull/879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech#diff-c3JjL2NvbXBvbmVudHMvcmVkaXMtcmVxdWVzdC9pbmRleC50cw==) | `11.11% <11.11%> (ø)` | |
| [src/components/config/validate.ts](https://codecov.io/gh/hyperjumptech/monika/pull/879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech#diff-c3JjL2NvbXBvbmVudHMvY29uZmlnL3ZhbGlkYXRlLnRz) | `60.69% <33.33%> (-1.89%)` | :arrow_down: |
| [src/components/notification/alert-message.ts](https://codecov.io/gh/hyperjumptech/monika/pull/879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech#diff-c3JjL2NvbXBvbmVudHMvbm90aWZpY2F0aW9uL2FsZXJ0LW1lc3NhZ2UudHM=) | `73.91% <40.00%> (+1.05%)` | :arrow_up: |
| [src/components/http-request/index.ts](https://codecov.io/gh/hyperjumptech/monika/pull/879/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech#diff-c3JjL2NvbXBvbmVudHMvaHR0cC1yZXF1ZXN0L2luZGV4LnRz) | `73.86% <100.00%> (ø)` | |

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperjumptech)

sapiderman: Dependency to #872 which needs to be merged first.

Patch:
diff --git a/src/components/config/create-config.ts b/src/components/config/create-config.ts
index ed304117..1cc7521b 100644
--- a/src/components/config/create-config.ts
+++ b/src/components/config/create-config.ts
@@ -39,7 +39,7 @@ export const createConfigFile = async (flags: any): Promise<string> => {
     log.info(
       `${filename} file has been created in this directory. You can change the URL to probe and other configurations in that ${filename} file.`
     )
-  } catch (error) {
+  } catch {
     const ymlConfig = `
     probes:
     - id: '1'
diff --git a/src/components/config/parse-sitemap.ts b/src/components/config/parse-sitemap.ts
index 3508f029..240ceae8 100644
--- a/src/components/config/parse-sitemap.ts
+++ b/src/components/config/parse-sitemap.ts
@@ -47,6 +47,7 @@ const generateProbesFromXml = (config: any) => {
         })
       }
     }
+
     return {
       id: item?.loc,
       name: item?.loc,
@@ -125,7 +126,7 @@ export const parseConfigFromSitemap = (
       probes = generateProbesFromXmlOneProbe(xmlObj)
     }
     return { probes }
-  } catch (error: any) {
+  } catch {
     throw new Error(
       'Your Sitemap file contains an invalid Sitemap XML format !'
     )
diff --git a/src/components/probe/probing.ts b/src/components/http-request/index.ts
similarity index 99%
rename from src/components/probe/probing.ts
rename to src/components/http-request/index.ts
index 763d6d2b..ec346d90 100644
--- a/src/components/probe/probing.ts
+++ b/src/components/http-request/index.ts
@@ -56,7 +56,7 @@ type probingParams = {
  * @param {obj} parameter as input object
  * @returns ProbeRequestResponse, response to the probe request
  */
-export async function probingHTTP({
+export async function httpRequest({
   requestConfig,
   responses,
 }: probingParams): Promise<ProbeRequestResponse> {
diff --git a/src/components/notification/alert-message.ts b/src/components/notification/alert-message.ts
index 599df30e..f052a098 100644
--- a/src/components/notification/alert-message.ts
+++ b/src/components/notification/alert-message.ts
@@ -60,6 +60,48 @@ type MessageAlertProps = {
   response: ProbeRequestResponse
 }
 
+const getExpectedMessage = (
+  alert: ProbeAlert,
+  response: ProbeRequestResponse,
+  isRecovery: boolean
+): string | number => {
+  const { status, data, headers, responseTime } = response
+  const isHTTPStatusCode = status >= 100 && status <= 599
+
+  if (!alert.message) {
+    if (isRecovery)
+      return `The request is back to normal and pass the query: ${alert.query}`
+    return `The request failed because the response does not pass the query: ${alert.query}. The actual response status is ${status} and the response time is ${responseTime}.`
+  }
+
+  if (!isHTTPStatusCode) {
+    switch (status) {
+      case 0:
+        return 'Host cannot be reached'
+      case 1:
+        return 'Connection reset'
+      case 2:
+        return 'Connection refused'
+      // for TCP request
+      case 5:
+        return isRecovery ? 'The request is back to normal' : alert?.message
+
+      default:
+        return status
+    }
+  }
+
+  return Handlebars.compile(alert.message)({
+    response: {
+      size: Number(headers['content-length']),
+      status,
+      time: responseTime,
+      body: data,
+      headers: headers,
+    },
+  })
+}
+
 export async function getMessageForAlert({
   probeID,
   alert,
@@ -86,47 +128,6 @@ export async function getMessageForAlert({
     monikaInstance,
     version: userAgent,
   }
-  const getExpectedMessage = (
-    alert: ProbeAlert,
-    response: ProbeRequestResponse,
-    isRecovery: boolean
-  ): string | number => {
-    const { status } = response
-    const isHTTPStatusCode = status >= 100 && status <= 599
-
-    if (!alert.message) {
-      if (isRecovery)
-        return `The request is back to normal and pass the query: ${alert.assertion}`
-      return `The request failed because the response does not pass the query: ${alert.assertion}. The actual response status is ${response.status} and the response time is ${response.responseTime}.`
-    }
-
-    if (!isHTTPStatusCode) {
-      switch (status) {
-        case 0:
-          return 'Host cannot be reached'
-        case 1:
-          return 'Connection reset'
-        case 2:
-          return 'Connection refused'
-        // for TCP request
-        case 5:
-          return isRecovery ? 'The request is back to normal' : alert?.message
-
-        default:
-          return status
-      }
-    }
-
-    return Handlebars.compile(alert.message)({
-      response: {
-        size: Number(response.headers['content-length']),
-        status,
-        time: response?.responseTime,
-        body: response.data,
-        headers: response.headers,
-      },
-    })
-  }
 
   const lastIncident = incidents.find(
     (incident) =>
diff --git a/src/components/notification/index.ts b/src/components/notification/index.ts
index a3597006..2c49aa6b 100644
--- a/src/components/notification/index.ts
+++ b/src/components/notification/index.ts
@@ -194,6 +194,7 @@ export async function sendNotifications(
                 }
                 break
               }
+
               case 'incident':
               case 'recovery': {
                 body = {
@@ -205,6 +206,7 @@ export async function sendNotifications(
                 }
                 break
               }
+
               case 'status-update': {
                 body = {
                   type: message.meta.type,
@@ -222,6 +224,7 @@ export async function sendNotifications(
                 }
                 break
               }
+
               default: {
                 break
               }
@@ -268,6 +271,7 @@ export async function sendNotifications(
             break
           }
         }
+
         return Promise.resolve()
       } catch (error: any) {
         throw NotificationSendingError.create(notification.type, error?.message)
@@ -290,7 +294,7 @@ export async function sendAlerts({
   notifications,
   url,
   probeState,
-}: SendAlertsProps) {
+}: SendAlertsProps): Promise<void> {
   const ipAddress = getIp()
   const isRecovery = probeState === 'UP'
   const message = await getMessageForAlert({
diff --git a/src/components/probe/index.ts b/src/components/probe/index.ts
index 4e2a28af..9be40a9f 100644
--- a/src/components/probe/index.ts
+++ b/src/components/probe/index.ts
@@ -22,7 +22,6 @@
  * SOFTWARE.                                                                      *
  **********************************************************************************/
 
-import { getContext } from '../../context'
 import events from '../../events'
 import { Notification } from '../../interfaces/notification'
 import { Probe } from '../../interfaces/probe'
@@ -34,11 +33,13 @@ import { getEventEmitter } from '../../utils/events'
 import { log } from '../../utils/pino'
 import { setProbeFinish, setProbeRunning } from '../../utils/probe-state'
 import { RequestLog } from '../logger'
-import { logResponseTime } from '../logger/response-time-log'
 import { sendAlerts } from '../notification'
 import { processThresholds } from '../notification/process-server-status'
+import { logResponseTime } from '../logger/response-time-log'
+
 import { tcpRequest } from '../tcp-request'
-import { probingHTTP } from './probing'
+import { getContext } from '../../context'
+import { httpRequest } from '../http-request'
 
 import { redisRequest } from '../redis-request'
 import { ServerAlertState } from '../../interfaces/probe-status'
@@ -136,6 +137,76 @@ async function checkThresholdsAndSendAlert(
     })
 }
 
+type respProsessingParams = {
+  probe: Probe // the actual probe that got this response
+  probeResult: ProbeRequestResponse // actual response from the probe
+  notifications: Notification[] // notifications contains all the notifications
+  logMessage: string // message from the probe to display
+  isAlertTriggered: boolean // flag, should alert be triggered?
+  index: number
+}
+/**
+ * responseProcessing determines if the last probe response warrants an alert
+ * creates the console log
+ * @param {object} param is response Processing type
+ * @returns void
+ */
+async function responseProcessing({
+  probe,
+  probeResult,
+  notifications,
+  logMessage,
+  isAlertTriggered,
+  index,
+}: respProsessingParams): Promise<void> {
+  const { flags } = getContext()
+  const isSymonMode = Boolean(flags.symonUrl) && Boolean(flags.symonKey)
+  const verboseLogs = isSymonMode || flags['keep-verbose-logs']
+
+  isAlertTriggered ? log.warn(logMessage) : log.info(logMessage)
+
+  const { alerts } = probe
+  const validatedResponse = validateResponse(
+    alerts || [
+      {
+        assertion: 'response.status < 200 or response.status > 299',
+        message: 'probe cannot be accessed',
+      },
+    ],
+    probeResult
+  )
+  const requestLog = new RequestLog(probe, index, 0)
+
+  requestLog.addAlerts(
+    validatedResponse
+      .filter((item) => item.isAlertTriggered)
+      .map((item) => item.alert)
+  )
+  const statuses = processThresholds({
+    probe,
+    requestIndex: index,
+    validatedResponse,
+  })
+
+  requestLog.setResponse(probeResult)
+  checkThresholdsAndSendAlert(
+    {
+      probe,
+      statuses,
+      notifications,
+      requestIndex: index,
+      validatedResponseStatuses: validatedResponse,
+    },
+    requestLog
+  ).catch((error) => {
+    requestLog.addError(error.message)
+  })
+
+  if (verboseLogs || requestLog.hasIncidentOrRecovery) {
+    requestLog.saveToDatabase().catch((error) => log.error(error.message))
+  }
+}
+
 type doProbeParams = {
   checkOrder: number // the order of probe being processed
   probe: Probe // probe contains all the probes
@@ -146,7 +217,6 @@ type doProbeParams = {
  * @param {object} param object parameter
  * @returns {Promise<void>} void
  */
-// eslint-disable-next-line complexity
 export async function doProbe({
   checkOrder,
   probe,
@@ -168,61 +238,21 @@ export async function doProbe({
 
     if (probe?.redis) {
       const { id, redis } = probe
-
       let redisRequestIndex = 0
       for await (const redisIndex of redis) {
-        const { host, port, username, password } = redisIndex
-
-        const redisRes = await redisRequest({
-          host: host,
-          port: port,
-          username: username,
-          password: password,
-        })
-
+        const { host, port } = redisIndex
+        const redisRes = await redisRequest({ host: host, port: port })
         const timeNow = new Date().toISOString()
         const logMessage = `${timeNow} ${checkOrder} id:${id} redis:${host}:${port} ${redisRes.responseTime}ms msg:${redisRes.body}`
-
         const isAlertTriggered = redisRes.status !== 200
-        isAlertTriggered ? log.warn(logMessage) : log.info(logMessage)
-
-        const { alerts } = redisIndex
-        const validatedResponse = validateResponse(
-          alerts || [
-            {
-              assertion: 'response.status < 200 or response.status > 299',
-              message: 'REDIS host cannot be accessed',
-            },
-          ],
-          redisRes
-        )
-        const requestLog = new RequestLog(probe, 0, 0)
-
-        requestLog.addAlerts(
-          validatedResponse
-            .filter((item) => item.isAlertTriggered)
-            .map((item) => item.alert)
-        )
-        const statuses = processThresholds({
-          probe,
-          requestIndex: redisRequestIndex,
-          validatedResponse,
-        })
-
-        requestLog.setResponse(redisRes)
-        checkThresholdsAndSendAlert(
-          {
-            probe,
-            statuses,
-            notifications,
-            requestIndex: redisRequestIndex,
-            validatedResponseStatuses: validatedResponse,
-          },
-          requestLog
-        ).catch((error) => {
-          requestLog.addError(error.message)
+        responseProcessing({
+          probe: probe,
+          probeResult: redisRes,
+          notifications: notifications,
+          logMessage: logMessage,
+          isAlertTriggered: isAlertTriggered,
+          index: redisRequestIndex,
         })
-
         redisRequestIndex++
       }
     }
@@ -231,61 +261,19 @@ export async function doProbe({
       const { id, socket } = probe
       const { host, port, data } = socket
       const url = `${host}:${port}`
-
       const probeRes = await tcpRequest({ host, port, data })
-
       const timeNow = new Date().toISOString()
       const logMessage = `${timeNow} ${checkOrder} id:${id} tcp:${url} ${probeRes.responseTime}ms msg:${probeRes.body}`
-
       const isAlertTriggered = probeRes.status !== 200
-
-      isAlertTriggered ? log.warn(logMessage) : log.info(logMessage)
-
-      // let TCPrequestIndex = 0 // are there multiple tcp requests?
-      // TCPrequestIndex < probe?.requests?.length;  // multiple tcp request, for later support
-      // TCPrequestIndex++                           // for later supported
       const TCPrequestIndex = 0
-
-      const { alerts } = socket
-      const validatedResponse = validateResponse(
-        alerts || [
-          {
-            assertion: 'response.status < 200 or response.status > 299',
-            message: 'TCP server cannot be accessed',
-          },
-        ],
-        probeRes
-      )
-      const requestLog = new RequestLog(probe, 0, 0)
-
-      requestLog.addAlerts(
-        validatedResponse
-          .filter((item) => item.isAlertTriggered)
-          .map((item) => item.alert)
-      )
-      const statuses = processThresholds({
-        probe,
-        requestIndex: TCPrequestIndex,
-        validatedResponse,
-      })
-
-      requestLog.setResponse(probeRes)
-      checkThresholdsAndSendAlert(
-        {
-          probe,
-          statuses,
-          notifications,
-          requestIndex: TCPrequestIndex,
-          validatedResponseStatuses: validatedResponse,
-        },
-        requestLog
-      ).catch((error) => {
-        requestLog.addError(error.message)
+      responseProcessing({
+        probe: probe,
+        probeResult: probeRes,
+        notifications: notifications,
+        logMessage: logMessage,
+        isAlertTriggered: isAlertTriggered,
+        index: TCPrequestIndex,
       })
-
-      if (verboseLogs || requestLog.hasIncidentOrRecovery) {
-        requestLog.saveToDatabase().catch((error) => log.error(error.message))
-      }
     }
 
     // sending multiple http-type requests
@@ -300,7 +288,7 @@ export async function doProbe({
       try {
         // intentionally wait for a request to finish before processing next request in loop
         // eslint-disable-next-line no-await-in-loop
-        const probeRes: ProbeRequestResponse = await probingHTTP({
+        const probeRes: ProbeRequestResponse = await httpRequest({
           requestConfig: request,
           responses,
         })
@@ -313,12 +301,11 @@ export async function doProbe({
           response: probeRes,
         })
 
-        // Add to a response array to be accessed by another request
+        // Add to a response array to be accessed by another request for chaining later
         responses.push(probeRes)
-
         requestLog.setResponse(probeRes)
 
-        // TODO: MOVE THIS DECODING TO THE PROBE/DRIVERS
+        // decode error message based on returned driver status
         if ([0, 1, 2, 3, 4, 599].includes(probeRes.status)) {
           const errorMessageMap: Record<number, string> = {
             0: 'URI not found', // axios error
@@ -365,7 +352,7 @@ export async function doProbe({
           requestLog.addError(error.message)
         })
 
-        // Exit the loop if there is any alert triggered
+        // Exit the chaining loop if there is any alert triggered
         if (validatedResponse.some((item) => item.isAlertTriggered)) {
           const triggeredAlertResponse = validatedResponse.find(
             (item) => item.isAlertTriggered


Test patch:
diff --git a/src/components/probe/probing.test.ts b/src/components/http-request/http-request.test.ts
similarity index 94%
rename from src/components/probe/probing.test.ts
rename to src/components/http-request/http-request.test.ts
index c2e4118a..55a969b3 100644
--- a/src/components/probe/probing.test.ts
+++ b/src/components/http-request/http-request.test.ts
@@ -29,7 +29,8 @@ import { RequestInterceptor } from 'node-request-interceptor'
 import withDefaultInterceptors from 'node-request-interceptor/lib/presets/default'
 import { setContext } from '../../context'
 import { RequestConfig } from '../../interfaces/request'
-import { probingHTTP } from './probing'
+
+import { httpRequest } from '.'
 
 describe('probingHTTP', () => {
   let interceptor: any
@@ -39,7 +40,7 @@ describe('probingHTTP', () => {
   afterEach(() => {
     interceptor.restore()
   })
-  describe('probingHTTP function', () => {
+  describe('httpRequest function', () => {
     it('should render correct headers', async () => {
       let verifyHeader: any = {}
       let tokens = ['1', '2']
@@ -93,11 +94,11 @@ describe('probingHTTP', () => {
       setContext({ flags: flag })
       for (let i = 0; i < 2; i++) {
         const responses: any = []
-        for (let j = 0; j < requests.length; j++) {
+        for (const [j, request] of requests.entries()) {
           try {
             // eslint-disable-next-line no-await-in-loop
-            const resp = await probingHTTP({
-              requestConfig: requests[j],
+            const resp = await httpRequest({
+              requestConfig: request,
               responses,
             })
             responses.push(resp)
@@ -111,8 +112,8 @@ describe('probingHTTP', () => {
         }
       }
 
-      for (let k = 0; k < results.length; k++) {
-        expect(results[k].sentToken).to.be.equals(results[k].expectedToken)
+      for (const result of results) {
+        expect(result.sentToken).to.be.equals(result.expectedToken)
       }
     })
 
@@ -138,7 +139,7 @@ describe('probingHTTP', () => {
 
       const flag: { followRedirects: number } = { followRedirects: 0 }
       setContext({ flags: flag })
-      const result = await probingHTTP({
+      const result = await httpRequest({
         requestConfig: request,
         responses: [],
       })
@@ -175,7 +176,7 @@ describe('probingHTTP', () => {
       setContext({ flags: flag })
       // act
       server.listen()
-      const res = await probingHTTP({
+      const res = await httpRequest({
         requestConfig: request,
         responses: [],
       })
@@ -216,7 +217,7 @@ describe('probingHTTP', () => {
       server.listen()
       const flag: { followRedirects: number } = { followRedirects: 0 }
       setContext({ flags: flag })
-      const res = await probingHTTP({
+      const res = await httpRequest({
         requestConfig: request,
         responses: [],
       })
@@ -257,7 +258,7 @@ describe('probingHTTP', () => {
       server.listen()
       const flag: { followRedirects: number } = { followRedirects: 0 }
       setContext({ flags: flag })
-      const res = await probingHTTP({
+      const res = await httpRequest({
         requestConfig: request,
         responses: [],
       })
@@ -299,7 +300,7 @@ describe('probingHTTP', () => {
       server.listen()
       const flag: { followRedirects: number } = { followRedirects: 0 }
       setContext({ flags: flag })
-      const res = await probingHTTP({
+      const res = await httpRequest({
         requestConfig: request,
         responses: [],
       })