diff --git a/packages/kbn-config/src/__snapshots__/env.test.ts.snap b/packages/kbn-config/src/__snapshots__/env.test.ts.snap index 39aae1dd9b2ff..e5d5a3816ced3 100644 --- a/packages/kbn-config/src/__snapshots__/env.test.ts.snap +++ b/packages/kbn-config/src/__snapshots__/env.test.ts.snap @@ -29,6 +29,7 @@ Env { "packageInfo": Object { "branch": "feature-v1", "buildDate": 2023-05-15T23:12:09.000Z, + "buildFlavor": "traditional", "buildNum": 9007199254740991, "buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "dist": false, @@ -71,6 +72,7 @@ Env { "packageInfo": Object { "branch": "feature-v1", "buildDate": 2023-05-15T23:12:09.000Z, + "buildFlavor": "traditional", "buildNum": 9007199254740991, "buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "dist": false, @@ -112,6 +114,7 @@ Env { "packageInfo": Object { "branch": "some-branch", "buildDate": 2023-05-15T23:12:09.000Z, + "buildFlavor": "traditional", "buildNum": 9007199254740991, "buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "dist": false, @@ -153,6 +156,7 @@ Env { "packageInfo": Object { "branch": "feature-v1", "buildDate": 2023-05-15T23:12:09.000Z, + "buildFlavor": "traditional", "buildNum": 100, "buildSha": "feature-v1-build-sha", "dist": true, @@ -194,6 +198,7 @@ Env { "packageInfo": Object { "branch": "feature-v1", "buildDate": 2023-05-15T23:12:09.000Z, + "buildFlavor": "traditional", "buildNum": 9007199254740991, "buildSha": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "dist": false, @@ -235,6 +240,7 @@ Env { "packageInfo": Object { "branch": "feature-v1", "buildDate": 2023-05-15T23:12:09.000Z, + "buildFlavor": "traditional", "buildNum": 100, "buildSha": "feature-v1-build-sha", "dist": true, diff --git a/packages/kbn-config/src/env.test.ts b/packages/kbn-config/src/env.test.ts index 5203c34b73214..7c301ff83e6f4 100644 --- a/packages/kbn-config/src/env.test.ts +++ b/packages/kbn-config/src/env.test.ts @@ -208,3 +208,43 @@ test('pluginSearchPaths only includes kibana-extra, regardless of plugin filters expect(env4.pluginSearchPaths).toEqual(['/some/home/kibana-extra', '/some/home/dir/plugins']); }); + +describe('packageInfo.buildFlavor', () => { + it('is set to `serverless` when the `serverless` cli flag is `true`', () => { + mockPackage.raw = { + branch: 'some-branch', + version: 'some-version', + }; + + const env = Env.createDefault( + REPO_ROOT, + getEnvOptions({ + configs: ['/test/cwd/config/kibana.yml'], + cliArgs: { + serverless: true, + }, + }) + ); + + expect(env.packageInfo.buildFlavor).toEqual('serverless'); + }); + + it('is set to `traditional` when the `serverless` cli flag is `false`', () => { + mockPackage.raw = { + branch: 'some-branch', + version: 'some-version', + }; + + const env = Env.createDefault( + REPO_ROOT, + getEnvOptions({ + configs: ['/test/cwd/config/kibana.yml'], + cliArgs: { + serverless: false, + }, + }) + ); + + expect(env.packageInfo.buildFlavor).toEqual('traditional'); + }); +});