Skip to content

Commit 3364ee6

Browse files
Fix stale work-queue integration fixtures (#67585)
1 parent fed2eb5 commit 3364ee6

4 files changed

Lines changed: 14 additions & 3 deletions

‎actions/setup/js/work_queue_control_adapter_checks.cjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ async function verifyCompiledDispatchIdentity(input) {
757757
assert.equal(dispatch.sender.principal, "11");
758758
assert.equal(dispatch.sender.run_attempt, 2);
759759
assert.equal(parameters.ref, REF);
760-
assert.equal(parameters.workflow_id, WORKFLOW);
760+
assert.equal(parameters.workflow_id, path.posix.basename(WORKFLOW));
761761
assert.notEqual(parameters.ref, fixture.dispatcherContext.sha);
762762
return { status: 200, data: { workflow_run_id: "42", run_url: "https://api.github.com/repos/owner/repo/actions/runs/42", html_url: "https://github.com/owner/repo/actions/runs/42" } };
763763
},

‎pkg/workflow/work_queue_compilation_integration_test.go‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ func TestWorkQueueDispatchCredentialActualCompilation(t *testing.T) {
9292
} else {
9393
require.Equal(t, -1, mint)
9494
}
95-
require.NotContains(t, string(content), "GH_AW_WORK_QUEUE_POLICY:")
95+
require.Contains(t, string(content), "GH_AW_WORK_QUEUE_POLICY:")
96+
require.Contains(t, string(content), `\"authorization\":\"aw\"`)
9697
})
9798
}
9899
}
@@ -195,7 +196,9 @@ Compile each work-queue workflow phase.
195196
func TestWorkQueueNamedProfileCompilation(t *testing.T) {
196197
dir := testutil.TempDir(t, "work-queue-named-profile-")
197198
path := filepath.Join(dir, "worker.md")
199+
// Keep coverage of legacy explicit profiles without repository-level scheduling.
198200
require.NoError(t, os.WriteFile(path, []byte(`---
201+
strict: false
199202
on: workflow_dispatch
200203
engine: claude
201204
tools:
@@ -221,6 +224,7 @@ safe-outputs:
221224
Use the explicitly approved profile without an implicit fallback worker.
222225
`), 0o600))
223226
compiler := NewCompiler(WithVersion("integration"))
227+
compiler.gitRoot = dir
224228
compiler.SetApprove(true)
225229
require.NoError(t, compiler.CompileWorkflow(path))
226230
content, err := os.ReadFile(filepath.Join(dir, "worker.lock.yml"))
@@ -569,7 +573,8 @@ Read the queue and dispatch an available Work identity.
569573
require.Contains(t, string(compiled), `work_queue_workflows`)
570574
require.Contains(t, string(compiled), `work_queue`)
571575
require.NotContains(t, string(compiled), "WORK_QUEUE_HMAC_SECRET")
572-
require.NotContains(t, string(compiled), "GH_AW_WORK_QUEUE_POLICY:")
576+
require.Contains(t, string(compiled), "GH_AW_WORK_QUEUE_POLICY:")
577+
require.Contains(t, string(compiled), `\"authorization\":\"aw\"`)
573578
inputs, err := extractWorkflowDispatchInputs(filepath.Join(workflowsDir, "dispatcher.lock.yml"))
574579
require.NoError(t, err)
575580
require.NotContains(t, inputs, WorkQueueClaimInputName)

‎pkg/workflow/work_queue_dispatch_identity_integration_test.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ func TestWorkQueueCompiledPolicyAndLaunchIdentity(t *testing.T) {
3333
dir := filepath.Join(testutil.TempDir(t, "compiled-queue-identity-"), ".github", "workflows")
3434
require.NoError(t, os.MkdirAll(dir, 0o700))
3535
require.NoError(t, os.WriteFile(filepath.Join(dir, "worker.md"), []byte("---\non: workflow_dispatch\ntools:\n work-queue:\n worker: true\n---\nProcess the original immutable assignment.\n"), 0o600))
36+
// Explicit principal policies remain supported only in legacy non-strict mode.
3637
source := fmt.Sprintf(`---
38+
strict: false
3739
on: workflow_dispatch
3840
engine: claude
3941
tools:
@@ -65,6 +67,7 @@ Dispatch only approved workers using the protected launch credential.
6567
filename := filepath.Join(dir, "dispatcher.md")
6668
require.NoError(t, os.WriteFile(filename, []byte(source), 0o600))
6769
compiler := NewCompiler(WithVersion("integration"))
70+
compiler.gitRoot = filepath.Dir(filepath.Dir(dir))
6871
compiler.SetApprove(true)
6972
require.NoError(t, compiler.CompileWorkflow(filename))
7073
content, err := os.ReadFile(filepath.Join(dir, "dispatcher.lock.yml"))

‎pkg/workflow/work_queue_persistent_memory_integration_test.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ func TestWorkQueueFactoryDocumentationExcerptsCompile(t *testing.T) {
9999
require.NoError(t, err)
100100
directory := filepath.Join(testutil.TempDir(t, "work-queue-factory-docs-"), ".github", "workflows")
101101
require.NoError(t, os.MkdirAll(directory, 0o700))
102+
shared, err := filepath.Abs("../../.github/workflows/shared")
103+
require.NoError(t, err)
104+
require.NoError(t, os.Symlink(shared, filepath.Join(directory, "shared")))
102105
for _, worker := range []string{"eslint-miner", "eslint-refiner", "eslint-monster"} {
103106
for _, extension := range []string{".md", ".lock.yml"} {
104107
target, err := filepath.Abs("../../.github/workflows/" + worker + extension)

0 commit comments

Comments
 (0)