nodejs-docs-samples icon indicating copy to clipboard operation
nodejs-docs-samples copied to clipboard

nodejs-container-analysis: samples tests are disabled for this repository

Open NimJay opened this issue 3 years ago • 4 comments

  • This is regarding the samples inside /container-analysis/snippets.
  • This issue was originally reported at https://github.com/googleapis/nodejs-containeranalysis/issues/441 by @alexander-fenster.
  • The reported issue:

The current samples tests depend on the sequence of invocation: the resource is being created in the first test, used in the next test, then deleted in a separate test. This organization of tests leads to flaky tests and is error-prone. Samples tests should be redesigned so that the tests could be executed independently (so that skipping one test wouldn't cause failure of subsequent tests).

For now, I'm disabling all samples tests in https://github.com/googleapis/nodejs-containeranalysis/pull/440.

NimJay avatar Nov 15 '22 20:11 NimJay

This issue is specific to this test file.

ace-n avatar Jan 19 '23 19:01 ace-n

Splitting these tests apart would take ~1 engineer-day, which is quite a bit of time.

There are two easier approaches here:

  1. add retries to each of the current tests
  2. combine separate (create-get-delete) tests into a single test

@muncus and I discussed this, and we're in favor of Option 2.

@alexander-fenster @NimJay any objections?

ace-n avatar Jan 19 '23 20:01 ace-n

First off, Ace, thanks for looking into this issue (and even digging up the file that it's about, containerAnalysis.test.js).

Both approaches have their costs, so I'm good with either approach. If I understand correctly, approach 1 would add more noise to errors messages and use up more CPU (in some cases). Whereas, approach 2 would be less modular (e.g., the code might not be as clean).

NimJay avatar Jan 19 '23 22:01 NimJay

@NimJay one other point about Option 2:

If a particular step in the create-get-delete cycle fails (e.g. a get operation), it will cause the entire create-get-delete test to fail.

If that becomes an issue, I'm in favor of addressing it by adding retry-on-failure logic to these (broader) tests.

ace-n avatar Jan 19 '23 22:01 ace-n

Closing out as this is running now in https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/main/.github/workflows/container-analysis-snippets.yaml.

pattishin avatar Feb 22 '24 19:02 pattishin