Skip to content

Fixes Failing smoke test artifacts snapshot: Visualize Visualize Reporting Screenshots PNG reports: sample data created in 7.6 TSVB Gauge: PNG file matches the baseline image#226067

Merged
ymao1 merged 8 commits intoelastic:mainfrom
ymao1:reporting-test-189590
Jul 8, 2025

Conversation

@ymao1
Copy link
Copy Markdown
Contributor

@ymao1 ymao1 commented Jul 1, 2025

Fixes #189590

Summary

Test was failing with TypeError: Invalid URL, only on the smoke tests that are run on this pipeline, not locally.

The smoke tests run against real cloud deployments, so there is a difference in URLs between real deployments and local test runs. The issue occurs here:

const baseURL = formatUrl({
...kibanaServerConfig,
auth: false,
});
const urlWithoutBase = fullUrl.replace(baseURL, '');
const res = await this.security.testUserSupertest.get(urlWithoutBase);

For the smoke test, the fullUrl looks like https://kibana-pr-226067.kb.us-west2.gcp.elastic-cloud.com/internal/reporting/jobs/download/8446e53e-bafe-400d-8f28-4f923bfeadd8?elasticInternalOrigin=true but the baseUrl looks like https://kibana-pr-226067.kb.us-west2.gcp.elastic-cloud.com:443 because it's generated with the port. This causes the urlWithoutBase replacement to fail because the fullUrl does not include the port number.

For local testing, everything works fine because the fullUrl is http://localhost:5620/internal/reporting/jobs/download/1d9b0e64-b706-4916-855d-a5bbec9a5f02?elasticInternalOrigin=true and the baseUrl is http://localhost:5620 so the urlWithoutBase correctly ends up being /internal/reporting/jobs/download/1d9b0e64-b706-4916-855d-a5bbec9a5f02?elasticInternalOrigin=true

This fix catches any errors from the original request and retries them without the port in the baseUrl.

To Verify

  1. Check out this PR branch
  2. Get the credentials for the cloud deployment.
  3. The smoke test is run using this script: .buildkite/scripts/steps/artifacts/cloud.sh. To recreate it, set your environment variables in your terminal with the cloud deployment info:
export TEST_KIBANA_PROTOCOL=https
export TEST_KIBANA_HOSTNAME=kibana-pr-226067.kb.us-west2.gcp.elastic-cloud.com
export TEST_KIBANA_PORT=443
export TEST_KIBANA_USERNAME=elastic
export TEST_KIBANA_PASSWORD=<password>

export TEST_ES_PROTOCOL=https
export TEST_ES_HOSTNAME=kibana-pr-226067.es.us-west2.gcp.elastic-cloud.com
export TEST_ES_PORT=443
export TEST_ES_USERNAME=elastic
export TEST_ES_PASSWORD=<password>

export TEST_BROWSER_HEADLESS=1
export NODE_TLS_REJECT_UNAUTHORIZED=0

Then run node --no-warnings scripts/functional_test_runner.js --config x-pack/test/functional/apps/visualize/config.ts --include-tag=smoke --grep "TSVB Gauge: PNG file matches the baseline image"

The test should pass.

@ymao1 ymao1 added the ci:cloud-deploy Create or update a Cloud deployment label Jul 1, 2025
@ymao1 ymao1 force-pushed the reporting-test-189590 branch from 23fc205 to df50546 Compare July 2, 2025 01:14
@ymao1 ymao1 force-pushed the reporting-test-189590 branch from df50546 to d4b4ae0 Compare July 2, 2025 01:15
@ymao1 ymao1 changed the title Reporting test 189590 Fixes Failing smoke test artifacts snapshot: Visualize Visualize Reporting Screenshots PNG reports: sample data created in 7.6 TSVB Gauge: PNG file matches the baseline image Jul 2, 2025
@ymao1 ymao1 self-assigned this Jul 2, 2025
@ymao1 ymao1 added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// Feature:Reporting:Framework Reporting issues pertaining to the overall framework v9.2.0 labels Jul 2, 2025
@ymao1 ymao1 marked this pull request as ready for review July 2, 2025 11:33
@ymao1 ymao1 requested review from a team as code owners July 2, 2025 11:33
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@ymao1 ymao1 requested a review from markov00 July 3, 2025 12:26
@ymao1 ymao1 requested a review from a team as a code owner July 4, 2025 02:35
@ymao1 ymao1 removed the request for review from a team July 4, 2025 02:36
Copy link
Copy Markdown
Contributor

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, LGTM!

@ymao1
Copy link
Copy Markdown
Contributor Author

ymao1 commented Jul 8, 2025

@elasticmachine merge upstream

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Jul 8, 2025

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @ymao1

Copy link
Copy Markdown
Contributor

@JiaweiWu JiaweiWu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ymao1 ymao1 merged commit df6f6c4 into elastic:main Jul 8, 2025
12 checks passed
@ymao1 ymao1 deleted the reporting-test-189590 branch July 8, 2025 17:21
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
…rting Screenshots PNG reports: sample data created in 7.6 TSVB Gauge: PNG file matches the baseline image (elastic#226067)

Fixes elastic#189590

## Summary

Test was failing with `TypeError: Invalid URL`, only on the smoke tests
that are run on [this
pipeline](https://buildkite.com/elastic/kibana-artifacts-snapshot), not
locally.

The smoke tests run against real cloud deployments, so there is a
difference in URLs between real deployments and local test runs. The
issue occurs here:
https://github.com/elastic/kibana/blob/dc09cb5d8abe1d6a52977d0a7d8c69778c1eabd0/x-pack/platform/test/functional/page_objects/reporting_page.ts#L97-L102

For the smoke test, the `fullUrl` looks like
`https://kibana-pr-226067.kb.us-west2.gcp.elastic-cloud.com/internal/reporting/jobs/download/8446e53e-bafe-400d-8f28-4f923bfeadd8?elasticInternalOrigin=true`
but the `baseUrl` looks like
`https://kibana-pr-226067.kb.us-west2.gcp.elastic-cloud.com:443` because
it's generated with the port. This causes the `urlWithoutBase`
replacement to fail because the `fullUrl` does not include the port
number.

For local testing, everything works fine because the `fullUrl` is
`http://localhost:5620/internal/reporting/jobs/download/1d9b0e64-b706-4916-855d-a5bbec9a5f02?elasticInternalOrigin=true`
and the `baseUrl` is `http://localhost:5620` so the `urlWithoutBase`
correctly ends up being
`/internal/reporting/jobs/download/1d9b0e64-b706-4916-855d-a5bbec9a5f02?elasticInternalOrigin=true`

This fix catches any errors from the original request and retries them
without the port in the `baseUrl`.

## To Verify

1. Check out this PR branch
2. Get the credentials for the cloud deployment.
3. The smoke test is run using this script:
`.buildkite/scripts/steps/artifacts/cloud.sh`. To recreate it, set your
environment variables in your terminal with the cloud deployment info:

```
export TEST_KIBANA_PROTOCOL=https
export TEST_KIBANA_HOSTNAME=kibana-pr-226067.kb.us-west2.gcp.elastic-cloud.com
export TEST_KIBANA_PORT=443
export TEST_KIBANA_USERNAME=elastic
export TEST_KIBANA_PASSWORD=<password>

export TEST_ES_PROTOCOL=https
export TEST_ES_HOSTNAME=kibana-pr-226067.es.us-west2.gcp.elastic-cloud.com
export TEST_ES_PORT=443
export TEST_ES_USERNAME=elastic
export TEST_ES_PASSWORD=<password>

export TEST_BROWSER_HEADLESS=1
export NODE_TLS_REJECT_UNAUTHORIZED=0
```

Then run `node --no-warnings scripts/functional_test_runner.js --config
x-pack/test/functional/apps/visualize/config.ts --include-tag=smoke
--grep "TSVB Gauge: PNG file matches the baseline image"`

The test should pass.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:cloud-deploy Create or update a Cloud deployment Feature:Reporting:Framework Reporting issues pertaining to the overall framework release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.2.0

Projects

None yet

4 participants