diff --git a/automl/test/language_entity_extraction_create_model.test.js b/automl/test/language_entity_extraction_create_model.test.js index 919c820415..5584816fd2 100644 --- a/automl/test/language_entity_extraction_create_model.test.js +++ b/automl/test/language_entity_extraction_create_model.test.js @@ -20,32 +20,24 @@ const {AutoMlClient} = require('@google-cloud/automl').v1; const cp = require('child_process'); -const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); - -const CREATE_MODEL_REGION_TAG = 'language_entity_extraction_create_model'; +const CREATE_MODEL_REGION_TAG = 'language_entity_extraction_create_model.js'; const LOCATION = 'us-central1'; -const DATASET_ID = 'TEN8374527069979148288'; +const DATASET_ID = 'TEN0000000000000000000'; describe('Automl Natural Language Entity Extraction Create Model Test', () => { const client = new AutoMlClient(); // let operationId; // Natural language entity extraction models are non cancellable operations - it.skip('should create a model', async () => { + it('should create a model', async () => { + // As entity extraction does not let you cancel model creation, instead try + // to create a model from a nonexistent dataset, but other elements of the + // request were valid. const projectId = await client.getProjectId(); + const args = [CREATE_MODEL_REGION_TAG, projectId, LOCATION, DATASET_ID]; + const output = cp.spawnSync('node', args, {encoding: 'utf8'}); - const create_output = execSync( - `node ${CREATE_MODEL_REGION_TAG}.js ${projectId} ${LOCATION} ${DATASET_ID} extraction_test_create_model` - ); - - assert.match(create_output, /Training started/); - - // operationId = create_output - // .split('Training operation name: ')[1] - // .split('\n')[0]; + assert.match(output.stderr, /NOT_FOUND/); + assert.match(output.stderr, /Dataset does not exist./); }); - - // after('cancel model training', async () => { - // await client.operationsClient.cancelOperation({name: operationId}); - // }); });