Skip to content

Commit

Permalink
Support local run integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Wang <[email protected]>
  • Loading branch information
wanglam committed Oct 17, 2023
1 parent 7c6e1ef commit 4b08fa1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 46 deletions.
28 changes: 14 additions & 14 deletions packages/osd-opensearch/src/cli_commands/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports.help = (defaults = {}) => {
--download-only Download the snapshot but don't actually start it
--ssl Sets up SSL on OpenSearch
--P OpenSearch plugin artifact URL to install it on the cluster. We can use the flag multiple times
to install multiple plugins on the cluster snapshot. The argument value can be url to zip file, maven coordinates of the plugin
to install multiple plugins on the cluster snapshot. The argument value can be url to zip file, maven coordinates of the plugin
or for local zip files, use file:<followed by the absolute or relative path to the plugin zip file>.
Example:
Expand Down Expand Up @@ -78,21 +78,21 @@ exports.run = async (defaults = {}) => {
});

const cluster = new Cluster({ ssl: options.ssl });
if (options['download-only']) {
await cluster.downloadSnapshot(options);
} else {
const { installPath } = await cluster.installSnapshot(options);
// if (options['download-only']) {
// await cluster.downloadSnapshot(options);
// } else {
// const { installPath } = await cluster.installSnapshot(options);

if (options.dataArchive) {
await cluster.extractDataDirectory(installPath, options.dataArchive);
}
// if (options.dataArchive) {
// await cluster.extractDataDirectory(installPath, options.dataArchive);
// }

if (options.opensearchPlugins) {
await cluster.installOpenSearchPlugins(installPath, options.opensearchPlugins);
}
// if (options.opensearchPlugins) {
// await cluster.installOpenSearchPlugins(installPath, options.opensearchPlugins);
// }

options.bundledJDK = true;
// options.bundledJDK = true;

await cluster.run(installPath, options);
}
// await cluster.run(installPath, options);
// }
};
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ function extendNodeOptions(installDir) {
export async function runOpenSearchDashboardsServer({ procs, config, options }) {
const { installDir } = options;

await procs.run('opensearch-dashboards', {
cmd: getOpenSearchDashboardsCmd(installDir),
args: filterCliArgs(collectCliArgs(config, options)),
env: {
FORCE_COLOR: 1,
...process.env,
...extendNodeOptions(installDir),
},
cwd: installDir || OPENSEARCH_DASHBOARDS_ROOT,
wait: /http server running/,
});
// await procs.run('opensearch-dashboards', {
// cmd: getOpenSearchDashboardsCmd(installDir),
// args: filterCliArgs(collectCliArgs(config, options)),
// env: {
// FORCE_COLOR: 1,
// ...process.env,
// ...extendNodeOptions(installDir),
// },
// cwd: installDir || OPENSEARCH_DASHBOARDS_ROOT,
// wait: /http server running/,
// });
}

function getOpenSearchDashboardsCmd(installDir) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,24 @@ export function createLegacyOpenSearchTestCluster(options = {}) {
}

async start() {
let installPath;

if (opensearchFrom === 'source') {
installPath = (await cluster.installSource(config)).installPath;
} else if (opensearchFrom === 'snapshot') {
installPath = (await cluster.installSnapshot(config)).installPath;
} else if (path.isAbsolute(opensearchFrom)) {
installPath = opensearchFrom;
} else {
throw new Error(`unknown option opensearchFrom "${opensearchFrom}"`);
}

if (dataArchive) {
await cluster.extractDataDirectory(installPath, dataArchive);
}

await cluster.start(installPath, {
password: config.password,
opensearchArgs,
opensearchEnvVars,
});
// let installPath;
// if (opensearchFrom === 'source') {
// installPath = (await cluster.installSource(config)).installPath;
// } else if (opensearchFrom === 'snapshot') {
// installPath = (await cluster.installSnapshot(config)).installPath;
// } else if (path.isAbsolute(opensearchFrom)) {
// installPath = opensearchFrom;
// } else {
// throw new Error(`unknown option opensearchFrom "${opensearchFrom}"`);
// }
// if (dataArchive) {
// await cluster.extractDataDirectory(installPath, dataArchive);
// }
// await cluster.start(installPath, {
// password: config.password,
// opensearchArgs,
// opensearchEnvVars,
// });
}

async stop() {
Expand Down

0 comments on commit 4b08fa1

Please sign in to comment.