From 387984b0adecc4cd018e77cfab2976a8cf95763e Mon Sep 17 00:00:00 2001 From: "Xiaofei Cao (from Dev Box)" Date: Tue, 9 Jun 2026 15:06:41 +0800 Subject: [PATCH 1/2] test(azure-upgrade): point java migration e2e tests at upstream sample repos Replace the single weidongxu-microsoft/java-update-examples baseline with three pinned upstream repos so the migration assertions exercise the original Azure sample code: - file-based auth -> Azure-Samples/aad-java-manage-service-principals - EventProcessorHost -> logstash-plugins/logstash-input-azure_event_hubs (sparse checkout of .ci/integration/event_hub_consumer) - Batch defineNewApplicationPackage -> Azure-Samples/batch-java-manage-batch-accounts runJavaMigration now takes a { repoUrl, commitId, sparseCheckoutPath? } config and only adds the 'project can be found under ...' hint to the prompt when a sparse subpath is used. All three java-sdk-migration-e2e tests pass against the new baselines. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/azure-upgrade/integration.test.ts | 55 ++++++++++++++++--------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/tests/azure-upgrade/integration.test.ts b/tests/azure-upgrade/integration.test.ts index 2ddeed6f1..3951b48ce 100644 --- a/tests/azure-upgrade/integration.test.ts +++ b/tests/azure-upgrade/integration.test.ts @@ -50,8 +50,25 @@ const SKILL_NAME = "azure-upgrade"; // generous timeout as other migration integration tests. const javaMigrationTimeoutMs = 2700000; const FOLLOW_UP_PROMPT = ["Continue with recommended options until complete."]; -const JAVA_UPDATE_EXAMPLES_REPO = "https://github.com/weidongxu-microsoft/java-update-examples.git"; -const JAVA_UPDATE_EXAMPLES_COMMIT_ID = "6d071296df8929482b0903241a23713a0bb952a4"; + +// Per-scenario upstream sample repos. Each entry pins to a specific commit so +// the e2e tests are reproducible. Bump `commitId` to refresh the baseline. +const FILE_BASED_AUTH_REPO = { + repoUrl: "https://github.com/Azure-Samples/aad-java-manage-service-principals.git", + commitId: "83b446085a7ef35cf26b6d36255aa833aeb287bb", +} as const; + +const EVENT_PROCESSOR_HOST_REPO = { + repoUrl: "https://github.com/logstash-plugins/logstash-input-azure_event_hubs.git", + commitId: "4a05eea79342f1d451162d1a3e26270f6a484b4f", + // The Java sample lives in a subdirectory of this primarily-Ruby repo. + sparseCheckoutPath: ".ci/integration/event_hub_consumer", +} as const; + +const BATCH_ACCOUNTS_REPO = { + repoUrl: "https://github.com/Azure-Samples/batch-java-manage-batch-accounts.git", + commitId: "105a0766ca9d1c7866763f950dfe6700d25fa216", +} as const; // Check if integration tests should be skipped at module level const skipTests = shouldSkipIntegrationTests(); @@ -248,15 +265,20 @@ describeIntegration(`${SKILL_NAME}_ - Integration Tests`, () => { expect(pomDependencyBlocks(pomNoComments).some((dependency) => groupIdPattern.test(dependency))).toBe(false); }; - const runJavaMigration = async (sparseCheckoutPath: string, commitId: string): Promise<{ + const runJavaMigration = async (config: { + repoUrl: string; + commitId: string; + sparseCheckoutPath?: string; + }): Promise<{ agentMetadata: Awaited>; workspacePath: string; }> => { + const { repoUrl, commitId, sparseCheckoutPath } = config; let workspacePath: string | undefined; const agentMetadata = await agent.run({ setup: async (workspace: string) => { await cloneRepo({ - repoUrl: JAVA_UPDATE_EXAMPLES_REPO, + repoUrl, targetDir: workspace, depth: 1, sparseCheckoutPath, @@ -264,11 +286,15 @@ describeIntegration(`${SKILL_NAME}_ - Integration Tests`, () => { const git = simpleGit({ baseDir: workspace, binary: "git" }); await git.fetch(["--depth", "1", "origin", commitId]); await git.checkout(commitId); - workspacePath = path.join(workspace, ...sparseCheckoutPath.split("/")); + workspacePath = sparseCheckoutPath + ? path.join(workspace, ...sparseCheckoutPath.split("/")) + : workspace; }, prompt: - "Migrate my Java project from legacy Azure SDK to modern Azure SDK. " + - `The project can be found under ${sparseCheckoutPath}.`, + "Migrate my Java project from legacy Azure SDK to modern Azure SDK." + + (sparseCheckoutPath + ? ` The project can be found under ${sparseCheckoutPath}.` + : ""), nonInteractive: true, followUp: FOLLOW_UP_PROMPT, followUpTimeout: javaMigrationTimeoutMs @@ -283,10 +309,7 @@ describeIntegration(`${SKILL_NAME}_ - Integration Tests`, () => { test("migrates legacy file-based Azure auth (client init) to DefaultAzureCredential", async () => { await withTestResult(async () => { - const { workspacePath } = await runJavaMigration( - "azure-legacy-sdk-update-azure-client-initialization", - JAVA_UPDATE_EXAMPLES_COMMIT_ID, - ); + const { workspacePath } = await runJavaMigration(FILE_BASED_AUTH_REPO); const pomNoComments = readPomNoComments(workspacePath); @@ -316,10 +339,7 @@ describeIntegration(`${SKILL_NAME}_ - Integration Tests`, () => { test("migrates EventProcessorHost InMemory managers to BlobCheckpointStore", async () => { await withTestResult(async () => { - const { workspacePath } = await runJavaMigration( - "azure-legacy-sdk-update-eventhubs-v3", - JAVA_UPDATE_EXAMPLES_COMMIT_ID, - ); + const { workspacePath } = await runJavaMigration(EVENT_PROCESSOR_HOST_REPO); const pomNoComments = readPomNoComments(workspacePath); @@ -352,10 +372,7 @@ describeIntegration(`${SKILL_NAME}_ - Integration Tests`, () => { test("migrates Batch defineNewApplicationPackage chain to applicationPackages().define()", async () => { await withTestResult(async () => { - const { workspacePath } = await runJavaMigration( - "azure-legacy-sdk-update-batch-java-manage-batch-accounts", - JAVA_UPDATE_EXAMPLES_COMMIT_ID, - ); + const { workspacePath } = await runJavaMigration(BATCH_ACCOUNTS_REPO); const pomNoComments = readPomNoComments(workspacePath); From 26ff0b6c202e1934348a88b4cf853260db5cdaed Mon Sep 17 00:00:00 2001 From: "Xiaofei Cao (from Dev Box)" Date: Wed, 24 Jun 2026 17:08:49 +0800 Subject: [PATCH 2/2] apply change after switching to vally --- evals/azure-upgrade/eval.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/evals/azure-upgrade/eval.yaml b/evals/azure-upgrade/eval.yaml index 118561237..69247cb8c 100644 --- a/evals/azure-upgrade/eval.yaml +++ b/evals/azure-upgrade/eval.yaml @@ -244,7 +244,7 @@ stimuli: - name: "Java SDK migration - client init to DefaultAzureCredential" prompt: >- Migrate my Java project from legacy Azure SDK to modern Azure SDK. - The project can be found under java-update-examples/azure-legacy-sdk-update-azure-client-initialization. + The project can be found under aad-java-manage-service-principals. tags: type: integration tier: full @@ -254,9 +254,9 @@ stimuli: - "Continue with recommended options until complete." environment: commands: - - git clone --depth 1 --sparse https://github.com/weidongxu-microsoft/java-update-examples.git - - cd java-update-examples && git sparse-checkout set azure-legacy-sdk-update-azure-client-initialization - - cd java-update-examples && git fetch --depth 1 origin 6d071296df8929482b0903241a23713a0bb952a4 && git checkout 6d071296df8929482b0903241a23713a0bb952a4 + - git clone --depth 1 --sparse https://github.com/Azure-Samples/aad-java-manage-service-principals.git + - cd aad-java-manage-service-principals + - cd aad-java-manage-service-principals && git fetch --depth 1 origin 83b446085a7ef35cf26b6d36255aa833aeb287bb && git checkout 83b446085a7ef35cf26b6d36255aa833aeb287bb config: timeout: "45m" graders: @@ -300,7 +300,7 @@ stimuli: - name: "Java SDK migration - EventProcessorHost to BlobCheckpointStore" prompt: >- Migrate my Java project from legacy Azure SDK to modern Azure SDK. - The project can be found under java-update-examples/azure-legacy-sdk-update-eventhubs-v3. + The project can be found under logstash-input-azure_event_hubs/.ci/integration/event_hub_consumer tags: type: integration tier: full @@ -310,9 +310,9 @@ stimuli: - "Continue with recommended options until complete." environment: commands: - - git clone --depth 1 --sparse https://github.com/weidongxu-microsoft/java-update-examples.git - - cd java-update-examples && git sparse-checkout set azure-legacy-sdk-update-eventhubs-v3 - - cd java-update-examples && git fetch --depth 1 origin 6d071296df8929482b0903241a23713a0bb952a4 && git checkout 6d071296df8929482b0903241a23713a0bb952a4 + - git clone --depth 1 --sparse https://github.com/logstash-plugins/logstash-input-azure_event_hubs.git + - cd logstash-input-azure_event_hubs && git sparse-checkout set .ci/integration/event_hub_consumer + - cd logstash-input-azure_event_hubs && git fetch --depth 1 origin 4a05eea79342f1d451162d1a3e26270f6a484b4f && git checkout 4a05eea79342f1d451162d1a3e26270f6a484b4f config: timeout: "45m" graders: @@ -355,7 +355,7 @@ stimuli: - name: "Java SDK migration - Batch applicationPackages define" prompt: >- Migrate my Java project from legacy Azure SDK to modern Azure SDK. - The project can be found under java-update-examples/azure-legacy-sdk-update-batch-java-manage-batch-accounts. + The project can be found under batch-java-manage-batch-accounts. tags: type: integration tier: full @@ -365,9 +365,9 @@ stimuli: - "Continue with recommended options until complete." environment: commands: - - git clone --depth 1 --sparse https://github.com/weidongxu-microsoft/java-update-examples.git - - cd java-update-examples && git sparse-checkout set azure-legacy-sdk-update-batch-java-manage-batch-accounts - - cd java-update-examples && git fetch --depth 1 origin 6d071296df8929482b0903241a23713a0bb952a4 && git checkout 6d071296df8929482b0903241a23713a0bb952a4 + - git clone --depth 1 --sparse https://github.com/Azure-Samples/batch-java-manage-batch-accounts.git + - cd batch-java-manage-batch-accounts + - cd batch-java-manage-batch-accounts && git fetch --depth 1 origin 105a0766ca9d1c7866763f950dfe6700d25fa216 && git checkout 105a0766ca9d1c7866763f950dfe6700d25fa216 config: timeout: "45m" graders: