Skip to content

Commit 77aabe7

Browse files
authored
Remove java build step in integration test (#538)
* remove java build step + add to readme * remove basetestfixture * remove unused imports and add script
1 parent 8f39b3a commit 77aabe7

File tree

4 files changed

+25
-56
lines changed

4 files changed

+25
-56
lines changed

performance/SqlBindingBenchmarks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static void Main(string[] args)
1313
{
1414
bool runAll = args.Length == 0;
1515

16-
using var testFixture = new BaseTestFixture(false);
16+
using var testFixture = new IntegrationTestFixture();
1717

1818
// **IMPORTANT** If changing these make sure to update template-steps-performance.yml as well
1919
if (runAll || args.Contains("input"))
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Run this script from the root of the repository to build the
2+
# samples-java and test-java Azure Function projects and run the
3+
# Integration tests.
4+
5+
# Maven is required to build the Java projects.
6+
# Instructions to download Maven can be found here:
7+
# https://github.com/Microsoft/vscode-azurefunctions/wiki/Configure-Maven
8+
9+
# Build the samples-java project
10+
cd ./samples/samples-java
11+
mvn clean package
12+
13+
# Build the test-java project
14+
cd ../../test/Integration/test-java
15+
mvn clean package
16+
17+
# Run the Integration tests
18+
cd ../../..
19+
dotnet test

test/Integration/IntegrationTestFixture.cs

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,23 @@
33

44
using System;
55
using System.Diagnostics;
6-
using System.IO;
7-
using Microsoft.Azure.WebJobs.Extensions.Sql.Tests.Common;
8-
using Xunit;
96

107
namespace Microsoft.Azure.WebJobs.Extensions.Sql.Tests.Integration
118
{
129
/// <summary>
1310
/// Test fixture containing one-time setup code for Integration tests. See https://xunit.net/docs/shared-context for more details
1411
/// </summary>
15-
public class IntegrationTestFixture : BaseTestFixture
16-
{
17-
public IntegrationTestFixture() : base(true) { }
18-
}
19-
20-
/// <summary>
21-
/// Base test fixture - xUnit doesn't allow parameterized constructors so the benchmark tests will use this directly.
22-
/// </summary>
23-
public class BaseTestFixture : IDisposable
12+
public class IntegrationTestFixture : IDisposable
2413
{
2514
/// <summary>
2615
/// Host process for Azurite local storage emulator. This is required for non-HTTP trigger functions:
2716
/// https://docs.microsoft.com/azure/azure-functions/functions-develop-local
2817
/// </summary>
2918
private Process AzuriteHost;
3019

31-
public BaseTestFixture(bool buildJava)
20+
public IntegrationTestFixture()
3221
{
3322
this.StartAzurite();
34-
if (buildJava)
35-
{
36-
BuildJavaFunctionApps();
37-
}
3823
}
3924

4025
/// <summary>
@@ -56,44 +41,6 @@ protected void StartAzurite()
5641
this.AzuriteHost.Start();
5742
}
5843

59-
/// <summary>
60-
/// Build the samples-java and test-java projects.
61-
/// </summary>
62-
private static void BuildJavaFunctionApps()
63-
{
64-
string samplesJavaPath = Path.Combine(TestUtils.GetPathToBin(), "SqlExtensionSamples", "Java");
65-
BuildJavaFunctionApp(samplesJavaPath);
66-
67-
string testJavaPath = Path.Combine(TestUtils.GetPathToBin(), "..", "..", "..", "Integration", "test-java");
68-
BuildJavaFunctionApp(testJavaPath);
69-
}
70-
71-
/// <summary>
72-
/// Run `mvn clean package` to build the Java function app.
73-
/// </summary>
74-
private static void BuildJavaFunctionApp(string workingDirectory)
75-
{
76-
var maven = new Process()
77-
{
78-
StartInfo = new ProcessStartInfo
79-
{
80-
FileName = "mvn",
81-
Arguments = "clean package",
82-
WorkingDirectory = workingDirectory,
83-
WindowStyle = ProcessWindowStyle.Hidden,
84-
UseShellExecute = true
85-
}
86-
};
87-
88-
maven.Start();
89-
90-
const int buildJavaAppTimeoutInMs = 60000;
91-
maven.WaitForExit(buildJavaAppTimeoutInMs);
92-
93-
bool isCompleted = maven.ExitCode == 0;
94-
Assert.True(isCompleted, "Java function app did not build successfully");
95-
}
96-
9744
public void Dispose()
9845
{
9946
try

test/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ Our integration tests are based on functions from the samples project. To run in
3535
### Extension Bundle
3636
If you've made any changes to the CSharp extension, you will need to run the CopySqlDllToExtensionBundle.Ps1 to update your local extension bundle so that the tests can run against your latest changes.
3737
38+
### Running Java Tests
39+
Run the BuildJavaProjectsAndRunIntegrationTests.ps1 script in the scripts folder from the root of the repo to build the java projects and run the integration tests.
40+
3841
## Adding New Integration Tests
3942
When adding a new integration test for a function follow these steps:
4043

0 commit comments

Comments
 (0)