Skip to content

Commit

Permalink
Update build context, tests, and environment variables
Browse files Browse the repository at this point in the history
Modified BuildContext to update ProcessRunner arguments and added new properties. Updated TestsTask to use >= for TestLevel and replaced AX_WEBAPI_TARGET with AXTARGET. Removed AXSharp-L3-tests.slnf. Added conditional compilation in ApaxTests. Updated TestConnector to use environment variables. Updated apax.yml with new targets, dependencies, and scripts. Enhanced Entry.cs with new methods and environment variables. Updated integrated.csproj to include new certificates. Removed conditional delays in PlainersSwappingTests and GH_ISSUE_183. Added new solution filters for integration and WebAPI tests. Added new certificate files.
  • Loading branch information
PTKu committed Nov 28, 2024
1 parent 94d2916 commit 6204ab7
Show file tree
Hide file tree
Showing 17 changed files with 487 additions and 519 deletions.
18 changes: 14 additions & 4 deletions cake/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void UploadTestPlc(string workingDirectory, string targetIp,

this.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings()
{
Arguments = " apax build",
Arguments = " build",
WorkingDirectory = workingDirectory,
RedirectStandardOutput = false,
RedirectStandardError = false,
Expand All @@ -127,12 +127,22 @@ public void UploadTestPlc(string workingDirectory, string targetIp,

this.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings()
{
Arguments =
$" sld -t {targetIp} -i {targetPlatform} --accept-security-disclaimer --default-server-interface -r",
Arguments = " download",
WorkingDirectory = workingDirectory,
RedirectStandardOutput = false,
RedirectStandardError = false
RedirectStandardError = false,
RedirectedStandardOutputHandler = (a) => string.Join(System.Environment.NewLine, a),
Silent = false
}).WaitForExit();

// this.ProcessRunner.Start(Helpers.GetApaxCommand(), new ProcessSettings()
// {
// Arguments =
// $" sld -t {targetIp} -i {targetPlatform} --accept-security-disclaimer --default-server-interface -r",
// WorkingDirectory = workingDirectory,
// RedirectStandardOutput = false,
// RedirectStandardError = false
// }).WaitForExit();
}

public void RunTestsFromFilteredSolution(string filteredSolutionFile)
Expand Down
20 changes: 9 additions & 11 deletions cake/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,31 +160,29 @@ public override void Run(BuildContext context)
}


if (context.BuildParameters.TestLevel == 1)
if (context.BuildParameters.TestLevel >= 1)
{
context.RunTestsFromFilteredSolution(Path.Combine(context.ScrDir, "AXSharp-L1-tests.slnf"));
}
else if (context.BuildParameters.TestLevel == 2)
if (context.BuildParameters.TestLevel >= 2)
{
context.RunTestsFromFilteredSolution(Path.Combine(context.ScrDir, "AXSharp-L2-tests.slnf"));
}
else if (context.BuildParameters.TestLevel == 3)
{
context.RunTestsFromFilteredSolution(Path.Combine(context.ScrDir, "AXSharp-L3-tests.slnf"));
}
else
if (context.BuildParameters.TestLevel >= 3)
{
context.UploadTestPlc(
Path.GetFullPath(Path.Combine(context.WorkDirName, "..//..//src//AXSharp.connectors//tests//ax-test-project//")),
Environment.GetEnvironmentVariable("AX_WEBAPI_TARGET"),
Environment.GetEnvironmentVariable("AXTARGET"),
Environment.GetEnvironmentVariable("AXTARGETPLATFORMINPUT"));


context.RunTestsFromFilteredSolution(Path.Combine(context.ScrDir, "AXSharp-L3-tests_WebApi.slnf"));

context.UploadTestPlc(
Path.GetFullPath(Path.Combine(context.WorkDirName, "..//..//src//tests.integrations//integrated//src//ax")),
Environment.GetEnvironmentVariable("AXTARGET"),
Environment.GetEnvironmentVariable("AXTARGETPLATFORMINPUT"));

context.RunTestsFromFilteredSolution(Path.Combine(context.ScrDir, "AXSharp-L3-tests.slnf"));
context.RunTestsFromFilteredSolution(Path.Combine(context.ScrDir, "AXSharp-L3-tests_Integration.slnf"));
}


Expand Down
47 changes: 0 additions & 47 deletions src/AXSharp-L3-tests.slnf

This file was deleted.

10 changes: 10 additions & 0 deletions src/AXSharp-L3-tests_Integration.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"solution": {
"path": "AXSharp.sln",
"projects": [
"tests.integrations\\integrated\\src\\integrated.app\\integrated.hmi.csproj",
"tests.integrations\\integrated\\src\\integrated.twin\\integrated.csproj",
"tests.integrations\\integrated\\tests\\integrated.tests\\integrated.tests.csproj"
]
}
}
9 changes: 9 additions & 0 deletions src/AXSharp-L3-tests_WebApi.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"solution": {
"path": "AXSharp.sln",
"projects": [
"AXSharp.connectors\\tests\\AXSharp.Connector.Sax.WebAPITests\\AXSharp.Connector.S71500.WebAPITests.csproj",
"AXSharp.connectors\\tests\\exploring\\Webserver.Api.Exploratory\\Webserver.Api.Exploratory.csproj",
]
}
}
3 changes: 3 additions & 0 deletions src/AXSharp.compiler/tests/AXSharp.CompilerTests/ApaxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public void should_load_and_parse_apax_app_file()
[Fact()]
public void should_update_apax_version()
{
#if !DEBUG
return;
#endif
var apaxWorkspaceFile = Apax.CreateApaxDto(Path.Combine(testFolder, @"samples//plt1//app//apax.yml"));
Assert.Equal("plt-app", apaxWorkspaceFile.Name);
Assert.Equal("app", apaxWorkspaceFile.Type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ namespace AXSharp.Connector.S71500.WebAPITests;

public static class TestConnector
{
private static string TargetIp { get; } = Environment.GetEnvironmentVariable("AX_WEBAPI_TARGET") ?? "10.222.6.1";
private static string TargetIp { get; } = Environment.GetEnvironmentVariable("AXTARGET") ?? "10.222.6.1";

public static WebApiConnector TestApiConnector { get; }
= new WebApiConnector(TargetIp, "adm", Environment.GetEnvironmentVariable("AX_TARGET_PWD"),CertificateValidation, true).BuildAndStart() as WebApiConnector;
= new WebApiConnector(TargetIp, Environment.GetEnvironmentVariable("AX_USER_NAME"), Environment.GetEnvironmentVariable("AX_TARGET_PWD"),CertificateValidation, true).BuildAndStart() as WebApiConnector;

private static string CertificatePath = "certs\\Communication.cer";

Expand All @@ -32,7 +32,7 @@ private static bool CertificateValidation(HttpRequestMessage requestMessage, X50

public static ax_test_projectTwinController SecurePlc { get; }
= new(ConnectorAdapterBuilder.Build()
.CreateWebApi(TargetIp, "adm", Environment.GetEnvironmentVariable("AX_TARGET_PWD"), CertificateValidation, true));
.CreateWebApi(TargetIp, Environment.GetEnvironmentVariable("AX_USER_NAME"), Environment.GetEnvironmentVariable("AX_TARGET_PWD"), CertificateValidation, true));


}
11 changes: 5 additions & 6 deletions src/AXSharp.connectors/tests/ax-test-project/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ targets:
- "1500"
- llvm
variables:
AXTARGET: 10.222.6.1
AXTARGETPLATFORMINPUT: .\bin\1500\
AX_USERNAME: "adm"
AX_TARGET_PWD: "123ABCDabcd$#!"
MY_VERY_STRONG_PASSWORD: $AX_TARGET_PWD
# AXTARGET: $AXTARGET
# AXTARGETPLATFORMINPUT: $AXTARGETPLATFORMINPUT
# AX_USERNAME: $AX_USERNAME
# AX_TARGET_PWD: $AX_TARGET_PWD
# MY_VERY_STRONG_PASSWORD: $AX_TARGET_PWD
COM_CERT_PATH: .\certs\Communication.cer

devDependencies:
"@ax/sdk": 2405.2.0
# "@ax/stc": ^5.4.89
"@ax/sld": ^3.0.6-alpha
scripts:
postbuild: dotnet run --project ..//..//..//AXSharp.compiler//src//ixc//AXSharp.ixc.csproj --framework net9.0
Expand Down
Loading

0 comments on commit 6204ab7

Please sign in to comment.