MCPcopy Create free account
hub / github.com/github/gh-aw / TestRunDeployCommand_RoutesToOrgRunner

Function TestRunDeployCommand_RoutesToOrgRunner

pkg/cli/deploy_command_test.go:103–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func TestRunDeployCommand_RoutesToOrgRunner(t *testing.T) {
104 cmd := NewDeployCommand(func(string) error { return nil })
105 require.NotNil(t, cmd)
106 require.NoError(t, cmd.Flags().Set("org", "octo"))
107 require.NoError(t, cmd.Flags().Set("repos", "api-*"))
108 require.NoError(t, cmd.Flags().Set("yes", "true"))
109 require.NoError(t, cmd.Flags().Set("cool-down", "24h"))
110
111 origRunDeployForOrg := runDeployForOrgFn
112 origRunDeploy := runDeployFn
113 defer func() {
114 runDeployForOrgFn = origRunDeployForOrg
115 runDeployFn = origRunDeploy
116 }()
117
118 calledOrg := false
119 runDeployForOrgFn = func(ctx context.Context, org string, repoGlobs []string, workflows []string, addOpts AddOptions, coolDown time.Duration, yes bool, verbose bool) error {
120 calledOrg = true
121 assert.Equal(t, "octo", org)
122 assert.Equal(t, []string{"api-*"}, repoGlobs)
123 assert.Equal(t, []string{"githubnext/agentics/ci-doctor"}, workflows)
124 assert.True(t, yes)
125 assert.Equal(t, 24*time.Hour, coolDown)
126 return nil
127 }
128 runDeployFn = func(context.Context, string, []string, AddOptions, time.Duration) error {
129 t.Fatalf("single-repo deploy runner should not be called in --org mode")
130 return nil
131 }
132
133 err := runDeployCommand(cmd, []string{"githubnext/agentics/ci-doctor"}, func(string) error { return nil })
134 require.NoError(t, err)
135 assert.True(t, calledOrg)
136}
137
138func TestBuildDeployPRMetadata_SingleWorkflow(t *testing.T) {
139 title, body := buildDeployPRMetadata([]string{"githubnext/agentics/ci-doctor"}, "owner/repo")

Callers

nothing calls this directly

Calls 3

NewDeployCommandFunction · 0.85
runDeployCommandFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected