Skip to content

[kbn-test] improve check_ftr_configs script#189357

Merged
dmlemeshko merged 2 commits intoelastic:mainfrom
dmlemeshko:kbn-test/speedup-configs-checker
Jul 29, 2024
Merged

[kbn-test] improve check_ftr_configs script#189357
dmlemeshko merged 2 commits intoelastic:mainfrom
dmlemeshko:kbn-test/speedup-configs-checker

Conversation

@dmlemeshko
Copy link
Copy Markdown
Contributor

@dmlemeshko dmlemeshko commented Jul 29, 2024

Summary

Follow-up to #188854

On CI script is taking >1 min, while before it was taking seconds.
Probably because 80+ files were loaded as potential FTR configs. I adjusted regular expressions to minimize the amount of files that we need to load to validate if it is FTR config or not.

In this CI run script took 20s (part of Quick Checks group)

@dmlemeshko
Copy link
Copy Markdown
Contributor Author

/ci

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

✅ unchanged

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@dmlemeshko dmlemeshko added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting v8.16.0 labels Jul 29, 2024
@dmlemeshko dmlemeshko marked this pull request as ready for review July 29, 2024 12:02
@dmlemeshko dmlemeshko requested a review from a team as a code owner July 29, 2024 12:02
// async function config({ readConfigFile }: FtrConfigProviderContext)
// export default async function (ftrConfigProviderContext: FtrConfigProviderContext)
fileContent.match(
/(?:export\s+default\s+)?async\s+function(?:\s+\w+)?\s*\(\s*(?:\{\s*readConfigFile\s*\}|\w+)\s*(?::\s*FtrConfigProviderContext\s*)?\)/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we name this? That's a lot of reading lol

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, I can put it into variable with comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that would be better than reading 115 characters lol

fileContent.match(/(testRunner)|(testFiles)/) ||
// export default createTestConfig
fileContent.match(/export\s+default\s+createTestConfig/) ||
// export default async function ({ readConfigFile }: FtrConfigProviderContext)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you wanna drop these comments?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would keep it so the next person working on it have an idea of what text we are searching in files. Maybe rephrase it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Um, what do you mean?
Sounds like I'm missing something bud.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fileContent is a string with js/ts file content and we use regexp to find something that might tell if it is FTR config.
It is easy see an example that you can search repo with to find if some files still has the string, e.g. export default createTestConfig

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah, nvm I get it.

Copy link
Copy Markdown
Contributor

@wayneseymour wayneseymour left a comment

Choose a reason for hiding this comment

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

lgtm

@dmlemeshko dmlemeshko merged commit 0c45b11 into elastic:main Jul 29, 2024
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 release_note:skip Skip the PR/issue when compiling release notes v8.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants