Skip to content

Commit

Permalink
Use getUrlPartsWithStrippedDefaultPort instead of getUrlParts (#199264)
Browse files Browse the repository at this point in the history
## Summary

Use getUrlPartsWithStrippedDefaultPort to avoid this
[issue](#195902 (comment))
on MKI:

```
Serverless Observability - Deployment-agnostic api integration - Custom Threshold rule AVG - PCT - FIRED Rule creation should set correct action variables

Error: expected 'https://bk-serverless-ftr-3067-e697d43e3ad9-e0ac80.kb.eu-west-1.aws.qa.elastic.cloud/app/observability/alerts/1e0c2d3e-e5c2-4bfe-9df0-d46681253b9f'
to sort of equal 'https://bk-serverless-ftr-3067-e697d43e3ad9-e0ac80.kb.eu-west-1.aws.qa.elastic.cloud:443/app/observability/alerts/1e0c2d3e-e5c2-4bfe-9df0-d46681253b9f'
```
  • Loading branch information
maryam-saeidi authored Nov 7, 2024
1 parent c9d167f commit 996104f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
docCountTarget: 1,
});

const { protocol, hostname, port } = kbnTestConfig.getUrlParts();
const { protocol, hostname, port } = kbnTestConfig.getUrlPartsWithStrippedDefaultPort();
expect(resp.hits.hits[0]._source?.ruleType).eql('observability.rules.custom_threshold');
expect(resp.hits.hits[0]._source?.alertDetailsUrl).eql(
`${protocol}://${hostname}${port ? `:${port}` : ''}/app/observability/alerts/${alertId}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
docCountTarget: 1,
});

const { protocol, hostname, port } = kbnTestConfig.getUrlParts();
const { protocol, hostname, port } = kbnTestConfig.getUrlPartsWithStrippedDefaultPort();

expect(resp.hits.hits[0]._source?.ruleType).eql('observability.rules.custom_threshold');
expect(resp.hits.hits[0]._source?.alertDetailsUrl).eql(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
const resp = await alertingApi.waitForDocumentInIndex<ActionDocument>({
indexName: ALERT_ACTION_INDEX,
});
const { protocol, hostname, port } = kbnTestConfig.getUrlParts();
const { protocol, hostname, port } = kbnTestConfig.getUrlPartsWithStrippedDefaultPort();

expect(resp.hits.hits[0]._source?.ruleType).eql('observability.rules.custom_threshold');
expect(resp.hits.hits[0]._source?.alertDetailsUrl).eql(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
docCountTarget: 1,
});

const { protocol, hostname, port } = kbnTestConfig.getUrlParts();
const { protocol, hostname, port } = kbnTestConfig.getUrlPartsWithStrippedDefaultPort();
expect(resp.hits.hits[0]._source?.ruleType).eql('observability.rules.custom_threshold');
expect(resp.hits.hits[0]._source?.alertDetailsUrl).eql(
`${protocol}://${hostname}${port ? `:${port}` : ''}/app/observability/alerts/${alertId}`
Expand Down

0 comments on commit 996104f

Please sign in to comment.