terascope / teraslice

Scalable data processing pipelines in JavaScript
https://terascope.github.io/teraslice/
Apache License 2.0
50 stars 13 forks source link

New asset generator unit test failures #3494

Closed busma13 closed 8 months ago

busma13 commented 9 months ago

This is the second time I've seen these two unit tests fail.

 FAIL  packages/teraslice-cli/test/generators/new-asset-spec.ts
  ● new asset generator should › should create the correct asset dir tree and put files in the correct dir

    assert(received)

    Expected value to be equal to:
      true
    Received:
      false

    Message:
      /home/runner/work/teraslice/teraslice/packages/teraslice-cli/test/fixtures/generate-new-asset/generated-asset/new_asset/package.json, no such file or directory

      30 |
      31 |     it('should create the correct asset dir tree and put files in the correct dir', () => {
    > 32 |         assert.file([
         |                ^
      33 |             path.join(rootAssetPath, 'package.json'),
      34 |             path.join(rootAssetPath, '.eslintrc'),
      35 |             path.join(rootAssetPath, '.editorconfig'),

      at node_modules/yeoman-assert/index.js:56:12
          at Array.forEach (<anonymous>)
      at Function.Object.<anonymous>.assert.file (node_modules/yeoman-assert/index.js:54:26)
      at Object.<anonymous> (packages/teraslice-cli/test/generators/new-asset-spec.ts:32:16)

  ● new asset generator should › should modify the file content with the name and description

    ENOENT: no such file or directory, open '/home/runner/work/teraslice/teraslice/packages/teraslice-cli/test/fixtures/generate-new-asset/generated-asset/new_asset/package.json'

      43 |
      44 |     it('should modify the file content with the name and description', () => {
    > 45 |         assert.jsonFileContent(path.join(rootAssetPath, 'package.json'), {
         |                ^
      46 |             name: 'new_asset-bundle',
      47 |             description: 'this is a new asset',
      48 |             version: '0.1.0'

      at readFile (node_modules/yeoman-assert/index.js:32:19)
      at Function.Object.<anonymous>.assert.JSONFileContent.assert.jsonFileContent (node_modules/yeoman-assert/index.js:263:24)
      at Object.<anonymous> (packages/teraslice-cli/test/generators/new-asset-spec.ts:45:16)
godber commented 9 months ago

I just saw this too https://github.com/terascope/teraslice/actions/runs/7197386821/job/19604401446?pr=3497#logs

godber commented 9 months ago

Since this is a unit test it should be possible to run just this test over and over again in a loop until we see it fail.

busma13 commented 9 months ago

It looks like the errors are related to the timing of directories being created and destroyed. Creating temp directories with random names may fix this.

busma13 commented 9 months ago
● Test suite failed to run

    ENOENT: no such file or directory, uv_cwd

      at process.cwd (node_modules/graceful-fs/polyfills.js:10:19)
      at process.Object.<anonymous>.process.cwd (node_modules/graceful-fs/polyfills.js:10:19)
      at process.Object.<anonymous>.process.cwd (node_modules/graceful-fs/polyfills.js:10:19)
      at Object.<anonymous> (node_modules/@npmcli/arborist/lib/debug.js:21:11)
      at Object.<anonymous> (node_modules/@npmcli/arborist/lib/tree-check.js:1:35)
      at Object.<anonymous> (node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:11:19)
      at Object.<anonymous> (node_modules/@npmcli/arborist/lib/arborist/index.js:40:3)
      at Object.<anonymous> (node_modules/@npmcli/arborist/lib/index.js:1:38)
      at Object.<anonymous> (node_modules/yeoman-environment/lib/util/repository.js:6:18)
      at Object.<anonymous> (node_modules/yeoman-environment/lib/environment.js:28:26)
      at Object.<anonymous>.YeomanTest.createEnv (node_modules/yeoman-test/lib/index.js:254:10)
      at YeomanTest.Object.<anonymous>.YeomanTest.createTestEnv (node_modules/yeoman-test/lib/index.js:293:10)
      at RunContext.Object.<anonymous>.RunContext.build (node_modules/yeoman-test/lib/run-context.js:112:32)
      at RunContext.Object.<anonymous>.RunContext._run (node_modules/yeoman-test/lib/run-context.js:173:12)