MCPcopy Index your code
hub / github.com/github/gh-aw / TestImportMultipleTools

Function TestImportMultipleTools

pkg/workflow/importable_tools_test.go:186–260  ·  view source on GitHub ↗

TestImportMultipleTools tests importing multiple tools together

(t *testing.T)

Source from the content-addressed store, hash-verified

184
185// TestImportMultipleTools tests importing multiple tools together
186func TestImportMultipleTools(t *testing.T) {
187 tempDir := testutil.TempDir(t, "test-*")
188
189 // Create a shared workflow with multiple tools
190 sharedPath := filepath.Join(tempDir, "shared-all.md")
191 sharedContent := `---
192description: "Shared configuration with multiple tools"
193tools:
194 agentic-workflows: true
195 playwright:
196 version: "v1.41.0"
197permissions:
198 actions: read
199network:
200 allowed:
201 - playwright
202---
203
204# Shared All Tools Configuration
205`
206 if err := os.WriteFile(sharedPath, []byte(sharedContent), 0644); err != nil {
207 t.Fatalf("Failed to write shared file: %v", err)
208 }
209
210 // Create main workflow that imports all tools
211 workflowPath := filepath.Join(tempDir, "main-workflow.md")
212 workflowContent := `---
213on: issues
214engine: copilot
215imports:
216 - shared-all.md
217permissions:
218 actions: read
219 contents: read
220 issues: read
221 pull-requests: read
222---
223
224# Main Workflow
225
226Uses all imported tools.
227`
228 if err := os.WriteFile(workflowPath, []byte(workflowContent), 0644); err != nil {
229 t.Fatalf("Failed to write workflow file: %v", err)
230 }
231
232 // Compile the workflow
233 compiler := workflow.NewCompiler()
234 if err := compiler.CompileWorkflow(workflowPath); err != nil {
235 t.Fatalf("CompileWorkflow failed: %v", err)
236 }
237
238 // Read the generated lock file
239 lockFilePath := stringutil.MarkdownToLockFile(workflowPath)
240 lockFileContent, err := os.ReadFile(lockFilePath)
241 if err != nil {
242 t.Fatalf("Failed to read lock file: %v", err)
243 }

Callers

nothing calls this directly

Calls 6

CompileWorkflowMethod · 0.95
TempDirFunction · 0.92
NewCompilerFunction · 0.92
MarkdownToLockFileFunction · 0.92
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected