MCPcopy Create free account
hub / github.com/riverqueue/river / TestVersion

Function TestVersion

cmd/river/rivercli/river_cli_test.go:617–652  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

615}
616
617func TestVersion(t *testing.T) {
618 t.Parallel()
619
620 ctx := context.Background()
621
622 type testBundle struct {
623 buf *bytes.Buffer
624 }
625
626 setup := func(t *testing.T) (*version, *testBundle) {
627 t.Helper()
628
629 cmd, buf := withCommandBase(t, &version{})
630
631 return cmd, &testBundle{
632 buf: buf,
633 }
634 }
635
636 t.Run("PrintsVersion", func(t *testing.T) {
637 t.Parallel()
638
639 cmd, bundle := setup(t)
640
641 _, err := runCommand(ctx, t, cmd, &versionOpts{Name: "River"})
642 require.NoError(t, err)
643
644 buildInfo, _ := debug.ReadBuildInfo()
645
646 // `devel` on 1.25, `unknown` on versions previous to that
647 require.Regexp(t, strings.TrimSpace(fmt.Sprintf(`
648River version \((devel|unknown)\)
649Built with %s
650 `, buildInfo.GoVersion)), strings.TrimSpace(bundle.buf.String()))
651 })
652}
653
654// runCommand runs a CLI command while doing some additional niceties like
655// validating options.

Callers

nothing calls this directly

Calls 4

withCommandBaseFunction · 0.85
runCommandFunction · 0.85
HelperMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…