From 13b62c80b314aeafc0d2cc3dd474ef9e7c23dc44 Mon Sep 17 00:00:00 2001 From: PTKu <61538034+PTKu@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:06:23 +0100 Subject: [PATCH] fixing integration testing --- cake/Program.cs | 41 +++++++++++++------ .../TestConnector.cs | 2 + .../tests/ax-test-project/apax-lock.json | 20 ++++----- .../integrated/src/ax/apax-lock.json | 20 ++++----- .../integrated/src/integrated.twin/Entry.cs | 2 +- 5 files changed, 51 insertions(+), 34 deletions(-) diff --git a/cake/Program.cs b/cake/Program.cs index 11d4aed7..0f30fc2e 100644 --- a/cake/Program.cs +++ b/cake/Program.cs @@ -170,19 +170,34 @@ public override void Run(BuildContext context) } if (context.BuildParameters.TestLevel >= 3) { - context.UploadTestPlc( - Path.GetFullPath(Path.Combine(context.WorkDirName, "..//..//src//AXSharp.connectors//tests//ax-test-project//")), - 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_Integration.slnf")); + // This must be run in a separate environment! + try + { + context.UploadTestPlc( + Path.GetFullPath(Path.Combine(context.WorkDirName, "..//..//src//AXSharp.connectors//tests//ax-test-project//")), + Environment.GetEnvironmentVariable("AXTARGET"), + Environment.GetEnvironmentVariable("AXTARGETPLATFORMINPUT")); + + context.RunTestsFromFilteredSolution(Path.Combine(context.ScrDir, "AXSharp-L3-tests_WebApi.slnf")); + } + catch + { + System.Console.WriteLine("Some WebAPI tests failed. RUN IN APPROPRIATE EVNIRONMENT"); + } + + try + { + 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_Integration.slnf")); + } + catch + { + System.Console.WriteLine("Some WebAPI tests failed. RUN IN APPROPRIATE EVNIRONMENT"); + } } diff --git a/src/AXSharp.connectors/tests/AXSharp.Connector.Sax.WebAPITests/TestConnector.cs b/src/AXSharp.connectors/tests/AXSharp.Connector.Sax.WebAPITests/TestConnector.cs index 0e88edbf..c2644240 100644 --- a/src/AXSharp.connectors/tests/AXSharp.Connector.Sax.WebAPITests/TestConnector.cs +++ b/src/AXSharp.connectors/tests/AXSharp.Connector.Sax.WebAPITests/TestConnector.cs @@ -51,6 +51,8 @@ public static ax_test_projectTwinController SecurePlc securePlc = new(ConnectorAdapterBuilder.Build() .CreateWebApi(TargetIp, Environment.GetEnvironmentVariable("AX_USERNAME"), Environment.GetEnvironmentVariable("AX_TARGET_PWD"), CertificateValidation, true)); + + SecurePlc.Connector.BuildAndStart(); } return securePlc; } diff --git a/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json b/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json index a8e79e7d..f7e4bf29 100644 --- a/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json +++ b/src/AXSharp.connectors/tests/ax-test-project/apax-lock.json @@ -41,9 +41,9 @@ }, "@ax/sld": { "name": "@ax/sld", - "version": "3.0.6", - "integrity": "sha512-j90GJh1jMIpvB521EIxvTq6rhr8OO+6qqwsXn2Of7GxQrzwWi+NEXe9ss/ccFAKL0I7aEGD+SIW8jVHUgMAvow==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.6.tgz", + "version": "3.0.8", + "integrity": "sha512-4YSQf0eXLTGN0LmBBKFYUyhuhZAxH11W+kZfHAjXy5cIkJhhf5g50d/GDZHj5q5hcY/GEIerKLL+B3RUBejHgg==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.8.tgz", "cpu": [ "x64" ], @@ -617,6 +617,13 @@ ], "dependencies": {} }, + "@ax/st-docs": { + "name": "@ax/st-docs", + "version": "7.1.87", + "integrity": "sha512-J5BthD1BR0fu1dkqQFyW3yOByC14TxhG+b/NUl2zXkSqjnsAQQbNtdheZquZ225x0qkJAR8wRrBx9Kr3QdYg8w==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.1.87.tgz", + "dependencies": {} + }, "@ax/system-strings": { "name": "@ax/system-strings", "version": "7.1.47", @@ -679,13 +686,6 @@ ], "dependencies": {} }, - "@ax/st-docs": { - "name": "@ax/st-docs", - "version": "7.1.87", - "integrity": "sha512-J5BthD1BR0fu1dkqQFyW3yOByC14TxhG+b/NUl2zXkSqjnsAQQbNtdheZquZ225x0qkJAR8wRrBx9Kr3QdYg8w==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.1.87.tgz", - "dependencies": {} - }, "@ax/system-math": { "name": "@ax/system-math", "version": "7.1.47", diff --git a/src/tests.integrations/integrated/src/ax/apax-lock.json b/src/tests.integrations/integrated/src/ax/apax-lock.json index bc167ce5..dba2d364 100644 --- a/src/tests.integrations/integrated/src/ax/apax-lock.json +++ b/src/tests.integrations/integrated/src/ax/apax-lock.json @@ -41,9 +41,9 @@ }, "@ax/sld": { "name": "@ax/sld", - "version": "3.0.6", - "integrity": "sha512-j90GJh1jMIpvB521EIxvTq6rhr8OO+6qqwsXn2Of7GxQrzwWi+NEXe9ss/ccFAKL0I7aEGD+SIW8jVHUgMAvow==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.6.tgz", + "version": "3.0.8", + "integrity": "sha512-4YSQf0eXLTGN0LmBBKFYUyhuhZAxH11W+kZfHAjXy5cIkJhhf5g50d/GDZHj5q5hcY/GEIerKLL+B3RUBejHgg==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.8.tgz", "cpu": [ "x64" ], @@ -617,6 +617,13 @@ ], "dependencies": {} }, + "@ax/st-docs": { + "name": "@ax/st-docs", + "version": "7.1.87", + "integrity": "sha512-J5BthD1BR0fu1dkqQFyW3yOByC14TxhG+b/NUl2zXkSqjnsAQQbNtdheZquZ225x0qkJAR8wRrBx9Kr3QdYg8w==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.1.87.tgz", + "dependencies": {} + }, "@ax/system-strings": { "name": "@ax/system-strings", "version": "7.1.47", @@ -679,13 +686,6 @@ ], "dependencies": {} }, - "@ax/st-docs": { - "name": "@ax/st-docs", - "version": "7.1.87", - "integrity": "sha512-J5BthD1BR0fu1dkqQFyW3yOByC14TxhG+b/NUl2zXkSqjnsAQQbNtdheZquZ225x0qkJAR8wRrBx9Kr3QdYg8w==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.1.87.tgz", - "dependencies": {} - }, "@ax/system-math": { "name": "@ax/system-math", "version": "7.1.47", diff --git a/src/tests.integrations/integrated/src/integrated.twin/Entry.cs b/src/tests.integrations/integrated/src/integrated.twin/Entry.cs index b37d244f..d09ce61c 100644 --- a/src/tests.integrations/integrated/src/integrated.twin/Entry.cs +++ b/src/tests.integrations/integrated/src/integrated.twin/Entry.cs @@ -41,6 +41,6 @@ private static bool CertificateValidation(HttpRequestMessage requestMessage, X50 public static integratedTwinController Plc { get; } = new(ConnectorAdapterBuilder.Build() - .CreateWebApi(TargetIp, Environment.GetEnvironmentVariable("AX_USER_NAME"), Environment.GetEnvironmentVariable("AX_TARGET_PWD"), CertificateValidation, true)); + .CreateWebApi(TargetIp, Environment.GetEnvironmentVariable("AX_USERNAME"), Environment.GetEnvironmentVariable("AX_TARGET_PWD"), CertificateValidation, true)); } } \ No newline at end of file