MCPcopy
hub / github.com/grafana/tempo / TestUpdateFailsWhenPRUnresolved

Function TestUpdateFailsWhenPRUnresolved

tools/chloggen/cmd/update_test.go:383–407  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

381}
382
383func 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
409func TestUpdateListsAllUnresolvedPRs(t *testing.T) {
410 globalCfg = config.New(t.TempDir())

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
setupTestDirFunction · 0.85
runCobraFunction · 0.85
JoinMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected