MCPcopy
hub / github.com/nektos/act / runTest

Method runTest

pkg/runner/runner_test.go:174–219  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T, cfg *Config)

Source from the content-addressed store, hash-verified

172}
173
174func (j *TestJobFileInfo) runTest(ctx context.Context, t *testing.T, cfg *Config) {
175 fmt.Printf("::group::%s\n", j.workflowPath)
176
177 log.SetLevel(logLevel)
178
179 workdir, err := filepath.Abs(j.workdir)
180 assert.Nil(t, err, workdir)
181
182 fullWorkflowPath := filepath.Join(workdir, j.workflowPath)
183 runnerConfig := &Config{
184 Workdir: workdir,
185 BindWorkdir: false,
186 EventName: j.eventName,
187 EventPath: cfg.EventPath,
188 Platforms: j.platforms,
189 ReuseContainers: false,
190 Env: cfg.Env,
191 Secrets: cfg.Secrets,
192 Inputs: cfg.Inputs,
193 GitHubInstance: "github.com",
194 ContainerArchitecture: cfg.ContainerArchitecture,
195 Matrix: cfg.Matrix,
196 ActionCache: cfg.ActionCache,
197 }
198
199 runner, err := New(runnerConfig)
200 assert.Nil(t, err, j.workflowPath)
201
202 planner, err := model.NewWorkflowPlanner(fullWorkflowPath, true, false)
203 if j.errorMessage != "" && err != nil {
204 assert.Error(t, err, j.errorMessage)
205 } else if assert.Nil(t, err, fullWorkflowPath) {
206 plan, err := planner.PlanEvent(j.eventName)
207 assert.True(t, (err == nil) != (plan == nil), "PlanEvent should return either a plan or an error")
208 if err == nil && plan != nil {
209 err = runner.NewPlanExecutor(plan)(ctx)
210 if j.errorMessage == "" {
211 assert.Nil(t, err, fullWorkflowPath)
212 } else {
213 assert.Error(t, err, j.errorMessage)
214 }
215 }
216 }
217
218 fmt.Println("::endgroup::")
219}
220
221type TestConfig struct {
222 LocalRepositories map[string]string `yaml:"local-repositories"`

Callers 13

TestMaskValuesFunction · 0.95
TestRunEventSecretsFunction · 0.95
TestRunActionInputsFunction · 0.95
TestRunEventPullRequestFunction · 0.95
TestJobExecutorFunction · 0.80
TestRunEventFunction · 0.80
TestDryrunEventFunction · 0.80

Calls 5

PlanEventMethod · 0.95
NewWorkflowPlannerFunction · 0.92
NewFunction · 0.85
NewPlanExecutorMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected