(t *testing.T)
| 381 | } |
| 382 | |
| 383 | func TestUpdateFailsWhenPRUnresolved(t *testing.T) { |
| 384 | globalCfg = config.New(t.TempDir()) |
| 385 | |
| 386 | // A valid entry that left 'issues' empty. The temp dir is not a git repo, so |
| 387 | // the PR can't be backfilled. |
| 388 | entry := &chlog.Entry{ |
| 389 | ChangeType: chlog.BugFix, |
| 390 | Component: "receiver/foo", |
| 391 | Note: "Fix something", |
| 392 | User: "octocat", |
| 393 | } |
| 394 | setupTestDir(t, []*chlog.Entry{entry}) |
| 395 | |
| 396 | // Both --dry and a real update fail rather than emit an entry with no link. |
| 397 | _, err := runCobra(t, "update", "--dry") |
| 398 | require.ErrorContains(t, err, "could not determine a PR number") |
| 399 | |
| 400 | _, err = runCobra(t, "update") |
| 401 | require.ErrorContains(t, err, "could not determine a PR number") |
| 402 | |
| 403 | // The source entry file must not be deleted when the update fails. |
| 404 | remainingYAMLs, ioErr := filepath.Glob(filepath.Join(globalCfg.EntriesDir, "*.yaml")) |
| 405 | require.NoError(t, ioErr) |
| 406 | require.Equal(t, 2, len(remainingYAMLs)) |
| 407 | } |
| 408 | |
| 409 | func TestUpdateListsAllUnresolvedPRs(t *testing.T) { |
| 410 | globalCfg = config.New(t.TempDir()) |
nothing calls this directly
no test coverage detected