Skip to content

Commit

Permalink
fix: make output snapshot care for legacy branches, and how they migh…
Browse files Browse the repository at this point in the history
…t be included in the output
  • Loading branch information
delanni committed Oct 5, 2023
1 parent b23b77b commit cce457d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const PLUGIN_DIR = Path.resolve(REPO_ROOT, 'plugins/foo_test_plugin');
const PLUGIN_BUILD_DIR = Path.resolve(PLUGIN_DIR, 'build');
const PLUGIN_ARCHIVE = Path.resolve(PLUGIN_BUILD_DIR, `fooTestPlugin-7.5.0.zip`);
const TMP_DIR = Path.resolve(__dirname, '__tmp__');
const CURRENT_BRANCH = loadJsonFile.sync<{ branch: string }>(
Path.resolve(REPO_ROOT, 'package.json')
).branch;

expect.addSnapshotSerializer(createReplaceSerializer(/[\d\.]+ sec/g, '<time>'));
expect.addSnapshotSerializer(createReplaceSerializer(/\d+(\.\d+)?[sm]/g, '<time>'));
Expand All @@ -35,6 +38,8 @@ beforeEach(async () => {
afterEach(async () => await del([PLUGIN_DIR, TMP_DIR]));

it('builds a generated plugin into a viable archive', async () => {
const branchSegmentInUrl = CURRENT_BRANCH === 'main' ? 'current' : CURRENT_BRANCH;

const generateProc = await execa(
process.execPath,
['scripts/generate_plugin', '-y', '--name', 'fooTestPlugin'],
Expand All @@ -54,7 +59,7 @@ it('builds a generated plugin into a viable archive', async () => {
};

expect(filterLogs(generateProc.all)).toMatchInlineSnapshot(`
"Kibana is currently running with legacy OpenSSL providers enabled! For details and instructions on how to disable see https://www.elastic.co/guide/en/kibana/current/production.html#openssl-legacy-provider
"Kibana is currently running with legacy OpenSSL providers enabled! For details and instructions on how to disable see https://www.elastic.co/guide/en/kibana/${branchSegmentInUrl}/production.html#openssl-legacy-provider
succ 🎉
Your plugin has been created in plugins/foo_test_plugin
Expand All @@ -74,7 +79,7 @@ it('builds a generated plugin into a viable archive', async () => {
);

expect(filterLogs(buildProc.all)).toMatchInlineSnapshot(`
"Kibana is currently running with legacy OpenSSL providers enabled! For details and instructions on how to disable see https://www.elastic.co/guide/en/kibana/current/production.html#openssl-legacy-provider
"Kibana is currently running with legacy OpenSSL providers enabled! For details and instructions on how to disable see https://www.elastic.co/guide/en/kibana/${branchSegmentInUrl}/production.html#openssl-legacy-provider
info deleting the build and target directories
info run bazel and build required artifacts for the optimizer
succ bazel run successfully and artifacts were created
Expand Down

0 comments on commit cce457d

Please sign in to comment.