Skip to content

Commit

Permalink
[Test] Unskip serverless ES jest integration smoke test (#165316)
Browse files Browse the repository at this point in the history
## Summary

Unskip the `smoke` test we added for serverless jest integration and
update the root utilities.
  • Loading branch information
jloleysens authored Sep 1, 2023
1 parent 7ce2cb3 commit bc9b6f8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .buildkite/scripts/steps/test/jest_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ is_test_execution_step

.buildkite/scripts/bootstrap.sh

echo '--- Docker login'
echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co
trap 'docker logout docker.elastic.co' EXIT

echo '--- Jest Integration Tests'
.buildkite/scripts/steps/test/jest_parallel.sh jest.integration.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
* Side Public License, v 1.
*/

import Path from 'path';
import { defaultsDeep } from 'lodash';
import { Client, HttpConnection } from '@elastic/elasticsearch';
import { Cluster } from '@kbn/es';
import Path from 'path';
import { REPO_ROOT } from '@kbn/repo-info';
import { ToolingLog } from '@kbn/tooling-log';
import execa from 'execa';
import { CliArgs } from '@kbn/config';
import { createRoot, type TestElasticsearchUtils, type TestKibanaUtils } from './create_root';

Expand Down Expand Up @@ -64,6 +63,7 @@ export function createTestServerlessInstances({
};
}

const ES_BASE_PATH_DIR = Path.join(REPO_ROOT, '.es/es_test_serverless');
function createServerlessES() {
const log = new ToolingLog({
level: 'info',
Expand All @@ -74,15 +74,17 @@ function createServerlessES() {
es,
start: async () => {
await es.runServerless({
basePath: Path.join(REPO_ROOT, '.es/es_test_serverless'),
basePath: ES_BASE_PATH_DIR,
teardown: true,
background: true,
clean: true,
});
// runServerless doesn't wait until the nodes are up
await waitUntilClusterReady(getServerlessESClient());
return {
getClient: getServerlessESClient,
stop: async () => {
// hack to stop the ES cluster
await execa('docker', ['container', 'stop', 'es01', 'es02', 'es03']);
await es.stop();
},
};
},
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-es/src/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ exports.Cluster = class Cluster {
* @param {ServerlessOptions} options
*/
async runServerless(options = {}) {
// Ensure serverless ES nodes are not running
teardownServerlessClusterSync(this._log, options);
if (this._process || this._outcome) {
throw new Error('ES has already been started');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import {
createTestServerlessInstances,
} from '@kbn/core-test-helpers-kbn-server';

/**
* Until we merge https://github.com/elastic/kibana/pull/162673 this test should remain skipped.
*/
describe.skip('smoke', () => {
describe('smoke', () => {
let serverlessES: TestServerlessESUtils;
let serverlessKibana: TestServerlessKibanaUtils;
let root: TestServerlessKibanaUtils['root'];
Expand Down

0 comments on commit bc9b6f8

Please sign in to comment.