aws / aws/aws-cdk-cli

integ-runner: "Could not checkout snapshot directory" if HEAD branch does not contain snapshots

Open
#1,443 6 comments 2 reactions 0 assignees View on GitHub
bug p2
Dominant language
TypeScript
Stars
105
Forks
122
Avg merge
1d 17h
Merged PRs (30d)
71

Description

### Describe the bug

Running `integ-runner` results in a git failures:

```
Running test /Users/jvalore/Projects/mindful-composer2/test/integ.getConfiguration.ts in us-east-1
error: pathspec 'integ.getConfiguration.ts.snapshot' did not match any file(s) known to git
SUCCESS integ.getConfiguration-GetAppConfigurationLambda/DefaultTest 248.229s
AssertionResultsLambdaInvoked2f382cf205e7f04c4f85bed1cc026bf - success
AssertionResultsLambdaInvoke3c6d8322bda64b60f1d6ee49af533865 - success

Test Results:

Tests: 1 passed, 1 total
Could not checkout snapshot directory 'test/integ.getConfiguration.ts.snapshot'. Please verify the following command completes correctly:
git checkout $(git merge-base HEAD main) -- integ.getConfiguration.ts.snapshot
error: Error: Command exited with status 1
at exec2 (/Users/jvalore/Projects/mindful-composer2/node_modules/@aws-cdk/integ-runner/lib/workers/extract/index.js:12932:11)
at IntegTestRunner.checkoutSnapshot (/Users/jvalore/Projects/mindful-composer2/node_modules/@aws-cdk/integ-runner/lib/workers/extract/index.js:20124:13)
at IntegTestRunner.deploy (/Users/jvalore/Projects/mindful-composer2/node_modules/@aws-cdk/integ-runner/lib/workers/extract/index.js:20420:18)
at IntegTestRunner.runIntegTestCase (/Users/jvalore/Projects/mindful-composer2/node_modules/@aws-cdk/integ-runner/lib/workers/extract/index.js:20199:37)
at Function.integTestWorker (/Users/jvalore/Projects/mindful-composer2/node_modules/@aws-cdk/integ-runner/lib/workers/extract/index.js:30637:34)
at MessagePort. (/Users/jvalore/Projects/mindful-composer2/node_modules/@aws-cdk/integ-runner/lib/workers/extract/index.js:967:31)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
```

The message:
```
Could not checkout snapshot directory 'test/integ.getConfiguration.ts.snapshot'. Please verify the following command completes correctly:
git checkout $(git merge-base HEAD main) -- integ.getConfiguration.ts.snapshot
```
Looks like it doesn't include the `test/`path in the `git` command.

### Expected Behavior

Test should pass and update snapshot. (Ideally there shouldn't be `git` lock-in here either, but I guess that is a different discussion).

### Current Behavior

(See error message above)

### Reproduction Steps

Have an test in the default `test/` directory. In my case `test/integ.getConfiguration.ts`

Run `integ-runner --force` once. The snapshot is created in
```
test/integ.getConfiguration.ts.snapshot
```

`git add` and `git commit` the snapshot, as is recommended in the integ-runner docs.

Run `integ-runner --force` again.
Results in the error message listed above.

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.129.0 (build d5ab0df)

### Framework Version

_No response_

### Node.js Version

v20.9.0

### OS

Mac

### Language

TypeScript

### Language Version

4.8.4

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with integ-runner --force using a test in the default test/ directory, then inspect the integ-runner checkoutSnapshot entry point and the reported command. Verify the checkout handles test/integ.getConfiguration.ts.snapshot correctly and rerun the integration test to confirm the snapshot update completes without the git error.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, node.js, typescript
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
43/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.