Skip to content

RTECO-1362 - Add e2e test template for --fail-on-missing-deps flag - #3689

Draft
udaykb2 wants to merge 6 commits into
masterfrom
RTECO-1362-npm-fail-on-missing-deps
Draft

RTECO-1362 - Add e2e test template for --fail-on-missing-deps flag#3689
udaykb2 wants to merge 6 commits into
masterfrom
RTECO-1362-npm-fail-on-missing-deps

Conversation

@udaykb2

@udaykb2 udaykb2 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Add TestNpmInstallFailOnMissingDeps to verify the strict-mode flag behavior:

  • WITHOUT flag + missing cache: npm install succeeds (existing behavior)
  • WITH flag but no build-info collection: flag has no effect (succeeds)
  • WITH flag + build-info collection + missing cache: npm install fails (strict mode)

This test is skipped in sandbox environments due to network constraints (private npm registry unreachable) but serves as a comprehensive template for manual or CI verification when network access is available. The implementation steps are documented in the test comments.

  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • The pull request is targeting the master branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....

@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from 0734bd9 to d775bea Compare August 30, 2026 10:53
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from d775bea to 6e6d82c Compare August 30, 2026 11:29
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from 6e6d82c to 9ebe248 Compare August 30, 2026 11:50
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from 9ebe248 to 240f1bd Compare August 30, 2026 12:11
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from 240f1bd to 557816b Compare August 30, 2026 12:28
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from 557816b to bcc1fbc Compare August 30, 2026 12:58
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from bcc1fbc to a65ac00 Compare August 30, 2026 14:31
Add TestNpmInstallFailOnMissingDeps to verify the strict-mode flag behavior:
- WITHOUT flag + missing cache: npm install succeeds (existing behavior)
- WITH flag but no build-info collection: flag has no effect (succeeds)
- WITH flag + build-info collection + missing cache: npm install fails (strict mode)

This test is skipped in sandbox environments due to network constraints
(private npm registry unreachable) but serves as a comprehensive template
for manual or CI verification when network access is available. The
implementation steps are documented in the test comments.
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from a65ac00 to d2e6ee6 Compare August 30, 2026 14:49
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from 29f043a to f5df206 Compare August 30, 2026 15:54
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from f5df206 to 2a08ea7 Compare August 30, 2026 16:07
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from 2a08ea7 to ee29d2f Compare August 30, 2026 16:32
…er strict mode error

Tests 4 & 5 were failing because cache was being rebuilt during npm install,
bypassing strict mode dependency checks. This fix implements the correct approach.

SOLUTION APPROACH:
  npm cache lookup flow:
    1. index-v5: metadata index (package@version → integrity)
    2. GetTarball: uses integrity to find tarball in content-v2
    3. When tarballs deleted + index-v5 removed:
    4. npm rebuilds index-v5 (normal during install)
    5. npm tries to find tarballs for checksums
    6. GetTarball fails (file not found)
    7. build-info detects missing dependencies
    8. strict mode error triggers ✓

This matches the pattern in removeOneNpmCachedTarball() for partial cache corruption.

Keeps _cacache directory intact so GetNpmConfigCache works correctly.
Keeps node_modules so npm doesn't repopulate from registry.

Expected results:
  - Test 4: All deps missing → fails with strict mode error ✓
  - Test 5: Partial missing (xml only) → fails with strict mode error ✓
  - Build-info NOT published in both cases ✓

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from ee29d2f to 5712b61 Compare August 30, 2026 16:41
- Added file:// and git:// dependencies to test package.json
- Enhanced TestNpmInstallWithFailOnMissingDepsFlag with build-info verification
- Enhanced TestNpmInstallFailsWithMissingCacheStrict with explicit assertions for all types
- Verify error message contains xml, json, file-dep, git-dep when strict mode fails
- Consolidated test coverage: 2 E2E scenarios covering 4 dependency types
- Added explicit verification for backward compatibility (success and failure paths)
…dencies

- Failure test: Verify error message contains xml, json, file-dep, git-dep
- Success test: Verify build-info published with all 4 dependency types
- Comprehensive coverage: All types tested in both success and failure paths
- Updates build-info-go to 8d24227 (RTECO-1362 npm strict mode)
- Updates jfrog-cli-artifactory to b210ce91 (dependency upgrade)
- Ensures jfrog-cli uses latest implementations from both repos
@udaykb2
udaykb2 force-pushed the RTECO-1362-npm-fail-on-missing-deps branch from 04e8e43 to 0d89266 Compare August 31, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant