Skip to content

Conversation

devstress
Copy link
Owner

Fix LocalTesting unit tests

@devstress devstress requested a review from Copilot September 16, 2025 03:32
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes LocalTesting unit tests by renaming the AppHost project from "BackPressure.AppHost" to "LocalTesting.FlinkSqlAppHost" and implementing several improvements for better test reliability and debugging. The changes focus on standardizing the naming convention and enhancing test infrastructure.

Key changes:

  • Renamed AppHost project and updated all references across test files
  • Added new BackPressure.Runner project with build automation for the Flink IR Runner JAR
  • Enhanced error handling and test robustness with retry mechanisms and extended timeouts

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
LocalTesting/LocalTesting.sln Updated project reference from BackPressure.AppHost to LocalTesting.FlinkSqlAppHost
LocalTesting/LocalTesting.FlinkSqlAppHost/* New AppHost project with proper naming and enhanced diagnostics
LocalTesting/LocalTesting.IntegrationTests/* Updated test references and added new IR string operations test
LocalTesting/BackPressure.Runner/* New project with automated JAR building and enhanced diagnostics
scripts/ensure-flink-runner.ps1 New script for automated Java/Maven setup and JAR building
FlinkDotNet/Flink.JobGateway/* Enhanced logging and validation for SQL jobs without sinks
BackPressureExample/BackPressure.IntegrationTests/KafkaTestBase.cs Improved retry logic and extended timeouts for test reliability

<Sdk Name="Aspire.AppHost.Sdk" Version="9.3.1" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
Copy link
Preview

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project correctly targets .NET 9.0 as required by the coding guidelines for local development environment enforcement.

Copilot generated this review using guidance from repository custom instructions.

<Sdk Name="Aspire.AppHost.Sdk" Version="9.3.1" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
Copy link
Preview

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project correctly targets .NET 9.0 as required by the coding guidelines for local development environment enforcement.

Copilot generated this review using guidance from repository custom instructions.

Comment on lines 48 to 64
if (!submitResult.Success)
{
// Validate the IR contains both operations (split + concat) for coverage
var irJson = FlinkDotNet.Flink.JobBuilder
.FromKafka(InputTopic, kafka)
.Map("split:,")
.Map("concat:-tail")
.WithTimer(5)
.ToKafka(OutputTopic, kafka)
.ToJson();
TestContext.WriteLine("Generated IR JSON:\n" + irJson);
Assert.That(irJson, Does.Contain("\"map\""));
Assert.That(irJson, Does.Contain("split:,"));
Assert.That(irJson, Does.Contain("concat:-tail"));
Assert.Pass("Runner JAR not present; IR structure validated.");
return;
}
Copy link
Preview

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block duplicates the JobBuilder chain from lines 38-43. Consider extracting this into a private method to eliminate code duplication and improve maintainability.

Copilot uses AI. Check for mistakes.

} elseif ($IsLinux) {
$jdkZip = '/tmp/temurin17.tar.gz'
$url = 'https://github.com/adoptium/temurin17-binaries/releases/latest/download/OpenJDK17U-jdk_x64_linux_hotspot.tar.gz'
} else { $jdkZip = '/tmp/temurin17.tar.gz'; $url='https://github.com/adoptium/temurin17-binaries/releases/latest/download/OpenJDK17U-jdk_aarch64_mac_hotspot.tar.gz' }
Copy link
Preview

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macOS detection logic is implicit (else clause). Consider adding explicit $IsMacOS check for better clarity and maintainability.

Suggested change
} else { $jdkZip = '/tmp/temurin17.tar.gz'; $url='https://github.com/adoptium/temurin17-binaries/releases/latest/download/OpenJDK17U-jdk_aarch64_mac_hotspot.tar.gz' }
} elseif ($IsMacOS) {
$jdkZip = '/tmp/temurin17.tar.gz'
$url = 'https://github.com/adoptium/temurin17-binaries/releases/latest/download/OpenJDK17U-jdk_aarch64_mac_hotspot.tar.gz'
} else {
throw "[ensure-flink-runner] Unsupported platform: cannot determine JDK download URL."
}

Copilot uses AI. Check for mistakes.

Comment on lines +80 to +86
var typeCount = 0;
var idx = 0;
while ((idx = json.IndexOf("\"type\"", idx, StringComparison.Ordinal)) >= 0)
{
typeCount++;
idx += 6;
}
Copy link
Preview

Copilot AI Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using string.IndexOf in a loop for counting occurrences is inefficient. Consider using a more efficient approach like splitting or regex counting for better performance, especially with large JSON payloads.

Copilot uses AI. Check for mistakes.

devstress and others added 4 commits September 16, 2025 15:44
1. Added Java and Maven installation to Gateway's Dockerfile
2. Updated Gateway build process to include building the Java project
3. Simplified LocalTesting to have a single test with a basic flow
4. Set up test environment with 1 Kafka, 1 FlinkDotnet, 1 Flink JobManager, and 1 Flink TaskManager
5. Implemented multiple FlinkDotnet jobs covering all implementations
6. Updated .gitignore to exclude generated JAR files
…ting

Fix FlinkDotnet Gateway build and LocalTesting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant